macos 彻底卸载重装mysql

笔记 / 2022-07-25
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
cd /Library/PreferencePanes/
rm -rf MySQL.prefPane
sudo rm -rf MySQL.prefPane
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /var/db/receipts/com.mysql.*
cd /usr/local/Cellar
ls |grep mysql
cd /usr/local/var

rm -rf mysql
sudo rm -rf mysql
cd /tmp
ls
 5558  rm -rf mysql.sock
 5559  sudo rm -rf mysql.sock
 5560  sudo rm -rf mysql.sock.lock
 5561  ls
 5562  sudo rm -rf mysqlx.sock
 5563  ls
 5564  sudo rm -rf mysqlx.sock.lock
 5565  clar
 5566  clear
 5567  ls
 5568  ll
 5569  cd /usr/local/
 5570  ls
 5571  brew cleanup
 5572  brew install mysql@8.0
 5573  mysql.server start
 5574  lsof -i:3306
 5575  lsof -i:8080
 5576  lsof -i:500
 5577  mysql -u root
 5578  sudo mysql.server start
 5579  sudo chown -R _mysql /usr/local/var/mysql
 5580  sudo mysql.server restart

出现 ... ERROR! The server quit without updating PID file (/usr/local/var/mysql/localhost.pid). 解决方案

sudo chown -R _mysql /usr/local/var/mysql
sudo mysql.server restart