MySQL不会出于任何原因在OSX El capitan上运行

时间:2016-09-07 13:12:02

标签: mysql macos homebrew osx-elcapitan

首先让我首先说我已经阅读并尝试了我在网上发现的所有方法和堆栈溢出。

我尝试运行时得到的结果

mysql.server start

sudo /usr/local/mysql/support-files/mysql.server start

ERROR! The server quit without updating PID file (/usr/local/var/mysql/hostname.local.pid).

我尝试跑步时得到的结果:

mysql

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

我也尝试过:

  1. sudo mysqld_safe &
  2. 单击系统首选项上的mysql开始按钮。
  3. 重新启动计算机
  4. 重新安装mysql
  5. 安装旧版本的mysql
  6. killall然后尝试运行mysql
  7. sudo chmod -R 777 /usr/local/mysql/
  8. `sudo chown -R mysql / var / lib / mysql /
  9. rm /usr/local/var/mysql/localhost.err
  10. sudo /usr/local/mysql/bin/mysqld_safe start
  11. 在这里尝试了一切:How to auto-load MySQL on startup on OS X Yosemite / El Capitan
  12. 我没有想法,我不知道该怎么做。

1 个答案:

答案 0 :(得分:0)

我做了什么让它真正起作用:

killall -u username
brew remove mysql
brew cleanup
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/var/mysql
sudo rm -rf /usr/local/mysql*
sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /private/var/db/receipts/*mysql*

*重新启动计算机

brew doctor and fix any errors
brew update
brew install mysql
unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
mysql.server start