mac install brewbrew warning 怎么处理

在 Mac 下用 Homebrew 安装 MySQL - 简洁的想法
仁爱、喜乐、和平、忍耐、恩慈、良善、信实、温柔、节制
在 Mac 下用 Homebrew 安装 MySQL
Jan 27th, 2014
在 Mac 下用 Homebrew 安装 MySQL, 网上的教程倒是很多,不过大多数都很默契地雷同。如果稍有点定制要求,就无从下手了。
我先也不免俗,从基本的开始:
一、首先安装 Homebrew
$ ruby -e &$(curl -fsSL /mxcl/homebrew/go)&
$ brew install git
$ brew update
二、安装 MySQL
用下面的命令就可以自动安装了:
$ brew install mysql
如果想让 MySQL 开机自动启动,可以如下操作:
$ mkdir -p ~/Library/LaunchAgents
$ ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
$ find /usr/local/Cellar/mysql/ -name &homebrew.mxcl.mysql.plist& -exec cp {} ~/Library/LaunchAgents/ \;
$ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
设置 MySQL 用户以及数据存放地址
$ unset TMPDIR
$ mysql_install_db --verbose --user=`whoami` --basedir=&$(brew --prefix mysql)& --datadir=/usr/local/var/mysql --tmpdir=/tmp
好了,可以启动了
$ mysql.server start
另外的参数还有 {start|stop|restart|reload|force-reload|status}
大部分的介绍就在此结束了。
三、更详细的设置
配置文件 my.cnf
作为用惯了 Linux 的人, 一定会去 /etc 下找 <f, 让你失望了,这个文件要自己建立。如果看一下帮助
$ mysqld --help --verbose
就会发现系统会按这个顺序去找 my.cnf
/usr/local/f
一般网上大虾都会这么教小白建立 my.cnf, 其实这个默认的文件里面几乎没什么内容。
$ sudo cp $(brew --prefix mysql)/support-files/f /f
所以,还是自己老老实实参考 linux 下的配置文件吧。
(my.cnf.txt)
# The MySQL database server configuration file.
# You can copy this to one of:
# - &/etc/f& to set global options,
# - &~/.my.cnf& to set user-specific options.
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
# For explanations see
# /doc/mysql/en/server-system-variables.html
# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with
# ticks/quotes escpecially if they contain &#& chars...
# Remember to edit /etc/f when changing
# the socket location.
= /var/run/mysqld/mysqld.sock
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
# This was formally known as [safe_mysqld]. Both versions
# are currently parsed.
[mysqld_safe]
= /var/run/mysqld/mysqld.sock
# * Basic Settings
# * IMPORTANT
If you make changes to these settings and your system uses
apparmor, you may also need to also adjust
/etc/apparmor.d/usr.sbin.mysqld.
= /var/run/mysqld/mysqld.sock
= /usr/local/var/mysql
skip-external-locking
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address
= 127.0.0.1
# * Fine Tuning
key_buffer
max_allowed_packet
thread_stack
thread_cache_size
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover
#max_connections
#table_cache
#thread_concurrency
# * Query Cache Configuration
query_cache_limit
query_cache_size
# * Logging and Replication
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file
= /var/log/mysql/mysql.log
#general_log
= /usr/local/var/mysql/MacBook15.local.err
# Here you can see queries with especially long duration
#log_slow_queries
= /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
# The following can be used as easy to replay backup logs or
# for replication.
# note: if you are setting up a replication slave, see
README.Debian about other settings you may need
to change.
#server-id
= /var/log/mysql/mysql-bin.log
expire_logs_days
max_binlog_size
#binlog_do_db
= include_database_name
#binlog_ignore_db
= include_database_name
# * InnoDB
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
# * Security Features
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
# For generating SSL certificates I recommend the OpenSSL GUI &tinyca&.
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
# Query Caching
query-cache-type = 1
# Default to InnoDB
default-storage-engine=innodb
[mysqldump]
quote-names
max_allowed_packet
#no-auto-rehash # faster start of mysql but no tab completition
key_buffer
错误日志默认会存在数据目录下,也就是上面所定义的 /usr/local/var/mysql/,如果 Mac 电脑名字是 MacBook,那日志的全路径就是 /usr/local/var/mysql/MacBook.local.err
让别的电脑访问数据库
取消下面两个文件中关于绑定 127.0.0.1 的语句
bind-address = 127.0.0.1
~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
&string&--bind-address=127.0.0.1&/string&
就我个人而言,不需要 MySQL 自启动,所以只要在 /f 改一下就好了。
Posted by Peter
Jan 27th, 2014
Please enable JavaScript to view the
Copyright & 2005 - 2016 - Peter - |
Powered by4245人阅读
1.Could not symlink share/systemtap/tapset/node.stp/usr/local/share/systemtap/tapset is not writable.
sudo rm -rf /usr/local/share/systemtap/
brew uninstall node
brew install node
2.nodejs终端命令行模式怎么退出
nodejs的命令需要在前面加点,可用.help查看所有命令,退出命令是.exit
3 rm: /usr/local/share/systemtap/tapset/node.stp: Permission denied
sudo rm -rf /usr/local/share/systemtap/tapset/node.stp
brew doctor 的作用检查homebrew,各模块是否正常
解决方法:
删除那些文件就可以了。
我出现这些问题的原因是node之前手动安装了,而node不是用brew安装的,所以会产生这样的问题。实际上,Homebrew 将软件包分装到单独的目录(/usr/local/Cellar),然后 symlink 到 /usr/local 中。
接下来我说说如何遇到上边那些问题的。因为无法还原,就简单的记录下过程。
安装node。
brew install node
Warning: Could not link node. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link node
根据提示,进行将brew管理的node和手动安装的node进行链接。
brew link node
Error: Could not symlink file: /usr/local/Cellar/node/0.10.0/bin/node
Target /usr/local/bin/node already exists. You may need to delete it.
To force the link and delete this file, do:
To list all files that would be deleted:
我尝试执行brew link –overwrite –dry-run formula_name,列出要删除的冲突文件,比如: /usr/local/bin/node删掉。
‘/usr/local/bin/node’
-rf ‘/usr/local/bin/node’
-rf ‘/usr/local/bin/node’
删除完。我遇到开始的第一个问题了。Could not symlink share/systemtap/tapset/node.stp /usr/local/share/systemtap/tapset is not writable。所以,就删除,然后重新安装了一边,就好了。
sudo rm -rf /usr/local/share/systemtap/
brew uninstall node
brew install node
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:120338次
积分:2517
积分:2517
排名:第12227名
原创:89篇
转载:209篇
评论:12条
(7)(4)(2)(4)(3)(2)(7)(2)(7)(10)(12)(6)(9)(16)(15)(7)(17)(18)(10)(15)(21)(10)(17)(25)(15)(23)(19)(1)Mac 下使用brew install 报错:
Cowardly refusing to `sudo brew install&#39; - 挥辉 - 博客园
爱欲追而情已逝,子欲孝而亲不待。人生的困苦又怎能用一个难字囊尽百味
posts - 391, comments - 133, trackbacks - 0, articles - 99
Mac 下使用brew install 报错:
localhost:infer-osx-v0.6.0 admin$ sudo brew install opam
Error: Cowardly refusing to `sudo brew install'
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.
用sudo执行brew命令,必须将 /usr/local/bin/brew 改成root
sudo chown root:wheel /usr/local/bin/brew
&sudo chmod go-w /usr/local/bin}

我要回帖

更多关于 mac brew mysql 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信