安裝
brew install mysql@5.7 // 安裝
brew link --force mysql@5.7 // 鏈接
brew services start mysql@5.7 // 啟動服務
brew services stop mysql@5.7 //停止
brew services restart mysql@5.7 //重啟
設置密碼
啟動之后,輸入一行命令
mysql_secure_installation
5.7.x對設置的密碼有嚴格的要求,分為LOW、MEDIUM、STRONG三個等級,對應要求如下:
LOW Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary file
選low即可,輸入8位,我這里使用12345678 ,其他一路y確認即可。
啟動
➜ ~ brew services start mysql@5.7
==> Successfully started `mysql@5.7` (label: homebrew.mxcl.mysql@5.7)
賬號:root
密碼:12345678