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;

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

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wpgwdw.html