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

mysql操作错误:

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

 

原因:没有设置允许远程连接的权限;

解决方法:

mysql> alter user user() identified by "123456";
Query OK, 0 rows affected (0.02 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
Query OK, 0 rows affected (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
给用户设置密码及访问权限,最后刷新flush即可。