Mac 安装 MySQL 5.7 后登入后无法执行命令【You must reset your password using ALTER USER statement before executing this statement.】


今天在 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;

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM