JDBC连接Mysql错误和异常

问题1:

Malformed database URL, failed to parse the connection string near ';characterEncoding=UTF-8'

升级为mysql8.0后链接错误,正确写法:

spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url = jdbc:mysql://localhost:3306/keepgoon?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong

问题2:

ERROR 1130: Host '127.0.0.7' is not allowed to connect to this MySQL server

第一步:先查询一下是不是host限制 (之前请use mysql)

select user,host from user;

第二步:将链接用户host 设置为 % ;

update user set host = '%' where user = 'root'

猜你喜欢

转载自blog.csdn.net/qq_26462567/article/details/85005406