java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed问题

Public Key Retrieval is not allowed问题

最近在学MyBatis,通过Configuration配置文件和mapper映射文件访问mysql8数据库的时候遇到了一个报错java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed,然后百度一下,发现好多人都出现这个错误,我的数据库版本是mysql-8.0.15-winx64,最后在连接数据库的url也就是spring.datasource.url拼接上allowPublicKeyRetrieval=true之后,问题就解决了。

spring.datasource.url=jdbc:mysql://localhost:3306/community?characterEncoding=utf-8&useSSL=false&serverTimezone=Hongkong&allowPublicKeyRetrieval=true

猜你喜欢

转载自blog.csdn.net/Lovely_Xiaoguo/article/details/108988070