Installation
使用Homebrew安装:
brew install mysql
bash中显示如下信息,安装成功。
We’ve installed your MySQL database without a root password. To secure it run:
mysql_secure_installation
To connect run:
mysql -uroot
To have launchd start mysql now and restart at login:
brew services start mysql
Or, if you don’t want/need a background service you can just run:
mysql.server start
运行之后显示错误信息
LINSPIRATIONs-MacBook-Pro:~ linspiration$ mysql.server start
Starting MySQL
. ERROR! The server quit without updating PID file (/usr/local/var/mysql/LINSPIRATIONs-MacBook-Pro.local.pid).
Configuration
我没有按照网上大部分的解决方案那样去对local.err或者PID进行修改,而是
1.
//删除usr/local中之前的安装文件夹,并用brew进行卸载
brew uninstall mysql
//如未解决问题,进行下一步
2.
//在bash中找到所有的mysql instance
ps -ef | grep mysql
3.
//关闭进程PID,PID为最后一行的
--pid-file=/usr/local/var/mysql/LINSPIRATIONs-MacBook-Pro.local.pid 501 76360 76349 0 10:08PM ttys000 0:00.00 grep mysql
//中的501 76360 76349
//然后 kill掉它
kill -9 501 76360 76349
4.
//重新运行sql server
mysql.server start
完成!