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

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

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

1
2
3
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". 

1
2
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

1
2
brew install mysql<br><br>mkdir -p ~/Library/LaunchAgents<em>ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist<br></em>mysql.server start<em id="__mceDel"> </em>

 

Then if mysql start successfully, 

1
mysql_secure_installation

 step by step.

 

PS: You might get this error:

 “ERROR! The server quit without updating PID file”.

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

 2 

1
ps aux | grep mysql

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

3

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

 

4

1
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

posted on   小浪鼓  阅读(1968)  评论(0编辑  收藏  举报

编辑推荐:
· 理解Rust引用及其生命周期标识(下)
· 从二进制到误差:逐行拆解C语言浮点运算中的4008175468544之谜
· .NET制作智能桌面机器人:结合BotSharp智能体框架开发语音交互
· 软件产品开发中常见的10个问题及处理方法
· .NET 原生驾驭 AI 新基建实战系列:向量数据库的应用与畅想
阅读排行:
· 2025成都.NET开发者Connect圆满结束
· Ollama本地部署大模型总结
· langchain0.3教程:从0到1打造一个智能聊天机器人
· 在 VS Code 中,一键安装 MCP Server!
· 用一种新的分类方法梳理设计模式的脉络
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示