You must reset your password using ALTER USER statement before executing this statement

错误描述

  刚搭建完mysql的环境,使用初始化的默认密码登入后,输入任何命令都会提示如下:

MySQL [(none)]>use mysql;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
MySQL [(none)]>show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

问题解决

  其实已经提示的很清楚了:在执行语句之前,必须要使用ALTER USER重置密码,那就重置呗。

MySQL [(none)]>alter user user() identified by '123456';
Query OK, 0 rows affected (0.00 sec)
MySQL [(none)]>show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)


原文地址:https://www.cnblogs.com/ccbloom/p/11374203.html