MacBook之brew安装mysql
2016-11-25 本文已影响0人
Yoteen
- 如果想重新安装mysql必须先卸载老mysql安装文件。
brew remove mysql
brew cleanup
launchctl unload -w ~/Library/LaunchAgents/com.mysql.mysqld.plist
rm ~/Library/LaunchAgents/com.mysql.mysqld.plist
sudo rm -rf /usr/local/var/mysql
- 下面开始重新安装mysql,第二句意思是设置mysql为开机启动项目。
brew install mysql
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
mysql.server start
- mysql安装完毕。下面配置密码信息;
mysql -uroot
select user,password,host from mysql.user;
delete from mysql.user where user='';
delete from mysql.user where host='::1';
set password for root@localhost=password('123456');
GRANT ALL PRIVILEGES ON *.* TO 'miaohr'@'%' IDENTIFIED BY '123456';
flush privileges;
- 如果想修改mysql的配置,在/usr/local/etc下建立一个my.cnf,例如增加log
[mysqld]
general-log
general_log_file = /usr/local/var/log/mysqld.log
- mysql.server restart