mysql连数据库的时候报错:
1251 client does not support authentication protocol requested by server;consider upgrading Mysql client ERROR 1396 (HY000): Operation ALTER USER failed for ‘root’@'localhost’
先登录mysql
mysql -u root -p
输入密码
mysql> use mysql;
mysql> select user,host from user;
注意我的root,host是’%’
你可能执行的是:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
改成:
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';
操作记录:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
ERROR 1396 (HY000): Operation ALTER USER failed for 'root'@'localhost'
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
mysql> select user,host from user;
+------------------+-----------+
| user | host |
+------------------+-----------+
| root | % |
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
+------------------+-----------+
4 rows in set (0.00 sec)mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';
Query OK, 0 rows affected (0.00 sec)mysql> quit
Bye