1. 程式人生 > >Mac 安裝 MySQL 5.7 後登入後無法執行命令【You must reset your password using ALTER USER statement before executing this statement.】

Mac 安裝 MySQL 5.7 後登入後無法執行命令【You must reset your password using ALTER USER statement before executing this statement.】

question 服務 com flow alter ima 5.7 use sql

今天在 Mac 上安裝了 MySQL 5.7 ,啟動服務後,輸入 mysql -u root -p 後,輸入初始密碼程,嘗試執行 show databases;

報了一個 You must reset your password using ALTER USER statement before executing this statement. 錯誤。

參考 Stack Overflow 上一篇文章 https://stackoverflow.com/questions/33467337/reset-mysql-root-password-using-alter-user-statement-after-install-on-mac

步驟如下:

set password = password(‘your new password‘);

alter user ‘root‘@‘localhost‘ password expire never;

flush privileges;

技術分享圖片

Mac 安裝 MySQL 5.7 後登入後無法執行命令【You must reset your password using ALTER USER statement before executing this statement.】