Mysql8.0默认加强加密连接方式修改为普通加密方式

Mysql8.0默认采用了新的caching_sha2_password的身份验证方式,此方式并不兼容常规的老的web服务接口,当然,不排除后面会出现。比如phpmyadmin5.0测试版已经出现兼容caching_sha2_password的模式。

为了继续维持我们常见的web连接的mysql身份验证方式,我们需要将默认的连接方式及root账户的连接方式恢复为旧的mysql_native_password方式。

1.使用root账户登入mysql,查询目前mysql的用户的身份验证方式。

select host,user,plugin,authentication_string from mysql.user;

  显示如下:

mysql> select host,user,plugin,authentication_string from mysql.user;
+-----------+------------------+-----------------------+------------------------------------------------------------------------+
| host      | user             | plugin                | authentication_string                                                  |
+-----------+------------------+-----------------------+------------------------------------------------------------------------+
| localhost | XXX               | mysql_native_password | *6XXXXXXXXXXXXXXXXXXXX61                              |
| localhost | mysql.infoschema | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIXXXXXXXXXXXXXBRBEUSED |
| localhost | mysql.session    | caching_sha2_password | $A$005$THISIXXXXXXXXXXXXXXXXXXXXXXXXXXSTNEVERBRBEUSED |
| localhost | mysql.sys        | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTXXXXXXXXXXXXVERBRBEUSED |
| localhost | root             | mysql_native_password | *67FXXXXXXXXXXXXXXXXXXXXX961                              |
+-----------+------------------+-----------------------+------------------------------------------------------------------------+
5 rows in set (0.00 sec)

mysql> 

  

可以在plugin看到身份插件验证方式.

更改root账户的验证方式为 mysql_native_password ,在mysql管理界面输入对应密码

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

  刷新配置启用

FLUSH PRIVILEGES;

  

 

posted @ 2021-01-31 12:17  云松编程  阅读(1058)  评论(0编辑  收藏  举报