java.sql.SQLException: Access denied for user root@172.16.2.20 (using password: YES)

启动spring架构连接数据库时,报错:

java.sql.SQLException: Access denied for user 'root'@'172.16.2.20' (using password: YES)

解决:

1.在架构连接数据库的位置增加&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true

url: jdbc:mysql://${myApp.uriDB}/smart?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true

2.进入数据库执行

mysql> grant all privileges on *.* to root@'%' identified by 'root登录密码' with grant option;

mysql> FLUSH PRIVILEGES;  

结束。

你可能感兴趣的