【mysql】You must reset your password using ALTER USER statement before executing this statement.
阿新 • • 發佈:2018-11-11
故障現場:登陸到MySQL伺服器,不管你執行什麼命令都報這個錯
- mysql> show databases;
- ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
- mysql> use test;
- ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
- ...
- ...
怎麼會這樣呢?難道我進的是假伺服器?
原因分析:這個主要是由一個引數控制的 default_password_lifetime,看看官方的解釋
仔細看哈,Note資訊有時候比上面的資訊有用(英文的note我一般都是忽略的,有可能你忽略掉的那部分對效能也有幫助哦)
問題解決:在開源的世界裡,我們不怕報錯,有報錯才有解決思路。下面來看下自己環境裡的
- mysql> select version();
- +--------------+
- | version() |
- +--------------+
- | 5.7.10-3-log |
- +--------------+
- 1 row in set (0.01 sec)
- mysql> show variables like 'default_password_lifetime';
- +---------------------------+-------+
- | Variable_name | Value |
- +---------------------------+-------+
- | default_password_lifetime | 360 |
- +---------------------------+-------+
- 1 row in set (0.00 sec)
alter user user() identified by "123456";