MySQL 首次安装后,执行命令提示:
1 3306 [(none)]>show databases; 2 ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
解决办法
1 #ALTER USER 'root'@'localhost' IDENTIFIED BY '123' PASSWORD EXPIRE NEVER; 2 #flush privileges;
1 3306 [(none)]>ALTER USER 'root'@'localhost' IDENTIFIED BY '123' PASSWORD EXPIRE NEVER; 2 Query OK, 0 rows affected (0.01 sec) 3 4 3306 [(none)]>flush privileges; 5 Query OK, 0 rows affected (0.00 sec) 6 7 3306 [(none)]>show databases; 8 +--------------------+ 9 | Database | 10 +--------------------+ 11 | information_schema | 12 | mysql | 13 | performance_schema | 14 | sys | 15 +--------------------+ 16 4 rows in set (0.01 sec)