mac升级OS X El Capitan 10.11.6 mysql 无法启动

昨天把Mac  OS X El Capitan 升级到10.11.6版本了,今天使用mysql的时候,发现连接不上数据库,phpmyadmin也不能登陆。感觉应该是mysql 没有启动,进入系统偏好设置里面发现mysql果然没有启动,点击启动,没有成功。

提示“Warning, /usr/local/mysql/data is not owned by 'mysql' or '_mysql'”

解决方法:依次执行如下命令

cd /usr/local/mysql

sudo chown -R _mysql data/

重启mysql就好了

来源去stackoverflow

 

Open a terminal:

  1. Check MySQL system pref panel, if it says something along the line "Warning, /usr/local/mysql/data is not owned by 'mysql' or '_mysql'
  2. If yes, go to the mysql folder cd /usr/local/mysql
  3. do a sudo chown -R _mysql data/
  4. This will change ownership of the /usr/local/mysql/data and all of its content to own by user '_mysql'
  5. Check MySQL system pref panel, it should be saying it's running now, auto-magically. If not start again.
  6. Another way to confirm is to do a

netstat -na | grep 3306

It should say:

tcp46 0 0 *.3306 . LISTEN

To see the process owner and process id of the mysqld:

ps aux | grep mysql