nacos-server配置中心连接数据库失败的解决方法

博主报的是:

org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.

 

解决:连接不上mysql,一般就是mysql或连接信息有问题,排除mysql,那就是连接信息 有问题了,修改 db.url.0 ,怎么改?

application.properties  : 

参与上面给的:

 

 

 

比如博主:

spring.datasource.platform=mysql
db.num=1
db.url.0=jdbc:mysql://127.0.0.1:3306/nacos_config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user=root
db.password=3333

 成功! 

 

 

 

 

posted @ 2021-08-29 12:16  小庄的blog  阅读(5141)  评论(0编辑  收藏  举报