1. 程式人生 > >mac下mysql的解除安裝和安裝

mac下mysql的解除安裝和安裝

1. mysql的解除安裝

1 sudo rm /usr/local/mysql
2 sudo rm -rf /usr/local/mysql*
3 sudo rm -rf /Library/StartupItems/MySQLCOM
4 sudo rm -rf /Library/PreferencePanes/My*
5 vim /etc/hostconfig (and removed the line MYSQLCOM=-YES-)
6 rm -rf ~/Library/PreferencePanes/My*
7 sudo rm -rf /Library/Receipts/mysql*
8 sudo rm -rf /Library/Receipts/MySQL*
9 sudo rm -rf /var/db/receipts/com.mysql.*

在我的mac上沒有Library資料夾,故6、7、8操作執行

2.下載mysql免費版

https://downloads.mysql.com/archives/community/

 

3.下載後dmg檔案後,雙擊後一步步安轉

4.生成一個密碼,待登入到mysql後,可以修改密碼;

5. 啟動mysql服務

sudo mysqld --user=mysql &    //不能用root使用者啟動

6.修改密碼
SET PASSWORD FOR'root'@'localhost'=PASSWORD('new password');
flush privileges;