MySQL更新到8版本之后,程序连接时报this authentication plugin is not supported 错误
解决方法
可能是以下两种方式导致的
方法一:
由于MySQL8的默认加密方式为caching_sha2_password,而之前版本的加密方式为mysql_native_password,所以可以通过修改MySQL 8的用户加密方式
alter user root@localhost identified with mysql_native_password by 'passwd';
解释:这行语句有两层含义,第一:修改root的密码为’ passwd’ ,摒弃原来的旧密码。第二:使用mysql_native_password对新密码进行编码。
alter user root@% identified with mysql_native_password by 'passwd';
如果修改后报this user requires mysql native password authentication
则修改MySQL的配置文件/etc/my.cnf,加上default-authentication-plugin=mysql_native_password
[mysqld]
default-authentication-plugin=mysql_native_password
重启MySQL服务
方法二:
MySQL驱动太老导致的,需要更新MySQL驱动