學(xué)習(xí)spring框架索守,按書上步驟走,卡在了第一步給root設(shè)置密碼抑片。搜了一圈也沒合適的解決方法卵佛,最后自己嘗試了一下解決了。
1敞斋、如果以前有安裝過MySQL截汪,按下面步驟徹底刪除后在重新安裝,避免一些奇怪的問題植捎。下面步驟如果有執(zhí)行不成功的可以忽略
- ps -ax | grep mysql
- 殺死所有與MySQL相關(guān)的進(jìn)程
- brew remove mysql
- brew cleanup
- 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*
- launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
- edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
- 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
- 重啟電腦
2衙解、使用brew安裝MySQL
安裝MySQL:
brew install mysql
安裝成功后啟動mysql:
mysql.server start
設(shè)置root密碼:
mysql_secure_installation
執(zhí)行上面命令后會回答一些問題,其中有一個讓你設(shè)置密碼焰枢。