java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed
在mysql 8中碰到这个问题。
我先创建用户,创建数据库,以及分配用户数据库的权限
create user 'test'@'192.168.96.1' identified by 'test';
grant all privileges on test.* to test@192.168.96.1;
结果:
我已经在数据库连接的url里指定了:
AllowPublicKeyRetrieval=True
但是还是出现这个错误。
参考:
https://stackoverflow.com/a/53300421
这个回答,是把mysql 8的默认密码方式改成:mysql_native_password
alter user test@192.168.96.1 identified with mysql_native_password by 'test';