且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Mysql密码已过期.无法连接

更新时间:2023-12-03 08:49:22

所以我终于找到了自己的解决方案.

So I finally found the solution myself.

首先,我进入终端并输入:

Firstly I went into terminal and typed:

mysql -u root -p

这要求输入我当前输入的密码,它使我能够提供更多的mysql命令.我从这里尝试过的任何操作都会出现此错误:

This asked for my current password which I typed in and it gave me access to provide more mysql commands. Anything I tried from here gave this error:

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

这令人困惑,因为我实际上看不到使用ALTER USER语句重设密码的方法,但是我确实找到了另一个简单的解决方案:

This is confusing because I couldn't actually see a way of resetting the password using ALTER USER statement, but I did find another simple solution:

SET PASSWORD = PASSWORD('xxxxxxxx');