傷痛美人兒 发表于 2015-12-30 07:57:35

Mysql On Mac OS: Remove & Install

  If you downloaded and installed from .dmg package already, and mightbe sometime it sucks because of some reason like me, i gem install mysql2.
  1 Remove mysql from you Mac OS X
  1.1 backup your database by mysqldump, of course if you want to.
  1.2 stop the database. "sudo mysqladmin shutdown" or from the preference panel.
  1.3 remove MySQL binary and configuration files



sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*

  1.4 If MySQL automatically at boot and the system preference panel,



sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
rm -rf ~/Library/PreferencePanes/My*

  1.5 mac OS keeps track of installed applications by tracking "receipts".



sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*

  Then look for receipts in a different location. Open up /Library/Receipts/InstallHistory.plist, find the entry for MySQL, delete the entry.
  One more location: look in /private/var/db/receipts/ and search for mysql in the directory. There should be 2 files, delete them.
  
  2 Install by Homebrew



brew install mysql
mkdir -p ~/Library/LaunchAgents
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

mysql.server start

  
  Then if mysql start successfully,



mysql_secure_installation

  step by step.
  
  PS: You might get this error:
  “ERROR! The server quit without updating PID file”.
  1



sudo chmod -R 755 /usr/local/var/mysql
$ rm -Rf /usr/local/var/mysql/Your-Machine-Name.local.err

  2



ps aux | grep mysql

  Then "kill -9 xxxx" to kill all the progress.
  3



mv /etc/my.cnf /etc/my.cnf.old

  
  4



mv /var/lib/mysql/ib_logfile* /root/

  May be other reasons, hope this helps.
  
  http://nali.org/remove-mysql-from-mac-os-x-snow-leopord/
  http://benjsicam.me/blog/how-to-install-mysql-on-mac-os-x-using-homebrew-tutorial/
  http://linuxadministrator.pro/blog/?p=225
页: [1]
查看完整版本: Mysql On Mac OS: Remove & Install