本地环境:
1.本地MySQL版本为8.0.1
2.MySQL驱动为新版
报错详情
com.alibaba.druid.pool.DruidDataSource - create connection SQLException,
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Public Key Retrieval is not allowed
Public Key Retrieval is not allowed
解决方案
更换
mysql
驱动
driver-class-name: com.mysql.cj.jdbc.Driver
复制代码
在
Url
后面加上allowPublicKeyRetrieval=true
url: jdbc:mysql://localhost:3306/test?characterEncoding=utf8&useSSL=false&serverTimezone=UTC&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
复制代码