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
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/
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 理解Rust引用及其生命周期标识(下)
· 从二进制到误差:逐行拆解C语言浮点运算中的4008175468544之谜
· .NET制作智能桌面机器人:结合BotSharp智能体框架开发语音交互
· 软件产品开发中常见的10个问题及处理方法
· .NET 原生驾驭 AI 新基建实战系列:向量数据库的应用与畅想
· 2025成都.NET开发者Connect圆满结束
· Ollama本地部署大模型总结
· langchain0.3教程:从0到1打造一个智能聊天机器人
· 在 VS Code 中,一键安装 MCP Server!
· 用一种新的分类方法梳理设计模式的脉络