MySQL8.0默认加密连接方式

2023-01-04 18:19:17 浏览数 (1)

Mysql8.0开始默认采用新的caching_sha2_password的身份验证方式,常规老接口会因此无法连接数据库。

为继续使用老的身份验证方式,需显式指定身份验证方式为 mysql_native_password,如下:

代码语言:txt复制
ALTER  USER 'ingp_auth'@'%' IDENTIFIED WITH mysql_native_password BY 'password^kAuAaj*Y';
flush privileges;

查询目前已有用户的身份验证方式:

代码语言:txt复制
mysql> select host,user,plugin,authentication_string from mysql.user;
 ----------- ---------------------------- ----------------------- ------------------------------------------------------------------------ 
| host      | user                       | plugin                | authentication_string                                                  |
 ----------- ---------------------------- ----------------------- ------------------------------------------------------------------------ 
| %         | inspur                     | mysql_native_password | *C8748776F9F2654A936BC271540A851C11E2AD3F                              |
| %         | liking                     | mysql_native_password | *A50765F60EB794160A595BCC438DB2956A249044                              |
| %         | proxysql                   | mysql_native_password | *F4E4F064BB1F087322285CE17C1CD5D0CA1BC03C                              |
| localhost | root                       | mysql_native_password | *9393526C69B0E40BBE014B55B19279B5E9C6983B                              |
 ----------- ---------------------------- ----------------------- ------------------------------------------------------------------------ 

0 人点赞