MySQL8.0.11装好后,使用SQLyog以ip方式连接MySQL,出现如下错误:
查看官网后,发现8.0.11的用户验证方式发生了改变:
https://dev.mysql.com/doc/refman/8.0/en/caching-sha2-pluggable-authentication.html
简而言之,从MySQL8.4开始,为了更好的性能,新增了caching_sha2_password验证方式,而之前为mysql_native_password验证方式。
明白了是怎么回事,有几种的解决办法:
#ALTER USER方式修改
alter user root@'172.18.16.%' identified with 'mysql_native_password' by'root';
flush privileges;
#create成mysql_native_password
create user yxli@'172.18.16.%' identified WITH mysql_native_password by 'yxli';
#配置到文件
[mysqld]
default_authentication_plugin=caching_sha2_password
create user yxli@'172.18.16.%' identified by 'yxli';