背景
mac 上安装MySQL 还是比较简单方便。只是在安装了mysql5.8 之后,在安装MariaDB,导致 MariaDB服务不能启动
卸载原mysql
brew uninstall mysql
brew cleanup
由于mysql 会有些遗留文件 需要手动删除
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*
sudo 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*
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
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*
以上都是从网上找到遗留文件 有些文件不一定存在
由于MariaDB与mysql5.8的配置文件有区别 所以还要删除配置文件
rm -rf /usr/local/etc/my.cnf.d
rm -rf /usr/local/etc/my.cnf.default
rm /usr/local/etc/my.cnf
rm /usr/local/etc/init.d/mysql.default
rm /usr/local/etc/init.d/mysql
rm /usr/local/etc/logrotate.d/mysql.default
rm /usr/local/etc/logrotate.d/mysql
特别说明
以上删除文件会导致原MySQL 数据库丢失。只是解决MariaDB 不能启动的问题。在学习和本机上可以这么操作。如果生产环境,应该由专业DBA解决
在安装MariaDB
brew install mariadb
启动
brew services start mariadb
#或者
mysql.server start
如果启动失败
用 mysql.server start 启动
Starting MariaDB
.201122 01:33:10 mysqld_safe Logging to '/usr/local/var/mysql/xxxx.err'.
201122 01:33:10 mysqld_safe Starting mariadbd daemon with databases from /usr/local/var/mysql
SUCCESS!
在Logging to 的日记文件中,可以查看错误日志,来分析失败原因
网友评论