mac brew 安装 mysql

安装MySql

$ brew install mysql

设置MySql开机启动

$ mkdir -p ~/Library/LaunchAgents    # 首先确认该目录是否存在,若已经存在不用执行本命令  
$ ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents  
$ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

启动MySql服务

$ mysql.server start  

错误修复
如果在启动过程中出现如下错误:ERROR! The server quit without updating PID file,使用以下方法修复。

$ sudo chmod -R 755 /usr/local/var/mysql

若仍不能启动,tail -f …pid 查看pid.err保错文件
InnoDB: Table flags are 0 in the data dictionary but the flags in file ./ibdata1 are 0x4800!

先前安装的mysql8创建了坏的DB文件,必须手动删除
rm -rf /usr/local/var/mysql
brew uninstall mysql@5.7
brew install mysql@5.7

使用Homebrew卸载MySql

$ brew remove mysql
$ brew cleanup
$ launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
$ rm -Rf ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值