MySQL8.0 caching_sha2_password报错问题

在bin目录下执行mysql -uroot -p123456

登录后执行:

use mysql;

select host, user, plugin from user;

 

打印:

+-----------+------------------+-----------------------+
| host | user | plugin |
+-----------+------------------+-----------------------+
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session | caching_sha2_password |
| localhost | mysql.sys | caching_sha2_password |
| localhost | root | caching_sha2_password |
+-----------+------------------+-----------------------+
4 rows in set (0.00 sec)

发现新版MySQL都是默认用caching_sha2_password这个plugin来加密密码了,HeidiSQL无法接入。现改成原生密码的加密方式。

 

执行:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';

flush privileges;

 

就可以了。再执行上面的查询语句,返回:

+-----------+------------------+-----------------------+
| host | user | plugin |
+-----------+------------------+-----------------------+
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session | caching_sha2_password |
| localhost | mysql.sys | caching_sha2_password |
| localhost | root | mysql_native_password |
+-----------+------------------+-----------------------+
4 rows in set (0.00 sec)

可知,已经改mysql_native_password插件了。

posted @ 2018-08-05 16:29  XIAOSHUA  阅读(5786)  评论(0编辑  收藏  举报