先检查 jdbc.properties的书写有无空格或者写错 或者 xml文件的书写
1.检查数据库权限设置
create user root@'%' identified by '12345678'; grant all privileges on *.* to root@'%' with grant option;
2.jdbc.properties配置检查(同样适用于mybatis 使用jdbc.properties文件设置不起作用)
jdbc.driver=com.mysql.cj.jdbc.Driver jdbc.url=jdbc:mysql://localhost:3306/test?useSSL=false&serverTimezone=UTC&characterEncoding=utf-8 characterEncoding=utf-8 jdbc.user=root jdbc.password=12345678
3.报错:java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed
增加
&allowPublicKeyRetrieval=true
变成
jdbc.driver=com.mysql.cj.jdbc.Driver jdbc.url=jdbc:mysql://localhost:3306/test?useSSL=false&serverTimezone=UTC&characterEncoding=utf-8&allowPublicKeyRetrieval=true characterEncoding=utf-8 jdbc.user=root jdbc.password=12345678
4.mybatis.xml代码



