昨天登录mysql(Server version: 5.7.11) 还是很好的,今天登录后执行任何命令都报下面的错误
[root@service2 ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.19
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use mysql
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> update user set authentication_string=password('Qaz123$%^') where user='root';
解决办法
1、 修改用户密码
mysql> alter user 'root'@'localhost' identified by 'Qaz123$%^';
或者
mysql> set password=password("alter user 'root'@'localhost' identified by 'Qaz123$%^'; ");
2、刷新权限
mysql> flush privileges;