当前位置: 移动技术网 > IT编程>开发语言>Java > nacos配置中心连接mysql8.0

nacos配置中心连接mysql8.0

2019年06月14日  | 移动技术网IT编程  | 我要评论

香港108期开奖结果,叶永青鸟,2016江苏高考英语答案

nacos配置中心连接mysql8.0

nacos连接mysql5.7正常,但是连接mysql8.0(mysql5.8)就提示错误。

org.springframework.jdbc.cannotgetjdbcconnectionexception: failed to obtain jdbc connection; nested exception is org.apache.commons.dbcp.sqlnestedexception: cannot create poolableconnectionfactory (could not create connection to database server. attempted reconnect 3 times. giving up.)

连接mysql5.7没问题。说明连接驱动版本有问题(为什么直接这么说呢,因为之前项目中mysql升级遇见过相同问题)。

把nacos 自带mysql-connector-java 版本升级以下就可以了,从5.1.34升级到5.1.47。

1、首先 git clone https://github.com/alibaba/nacos.git

 

2、如果速度慢,设置hosts。

修改 c:\windows\system32\drivers\etc。

151.101.185.194 github.global.ssl.fastly.net
192.30.253.112 github.com

 

3、

先把版本修改

 

然后执行打包命令

cd nacos/ mvn -prelease-nacos clean install -u

ls -al distribution/target/

// change the $version to your actual path

cd distribution/target/nacos-server-$version/nacos/bin

 

nacos\distribution\target\nacos-server-1.0.1\nacos\conf\application.properties

末尾添加:

spring.datasource.platform=mysql

db.num=1

db.url.0=jdbc:mysql://localhost:3306/nacos_devtest?characterencoding=utf8&connecttimeout=1000&sockettimeout=3000&autoreconnect=true

db.user=nacos_devtest

db.password=youdontknow

 

接着建库,执行mysql脚本

\nacos\distribution\target\nacos-server-1.0.1\nacos\conf\nacos-mysql.sql

接着你就可以启动bin文件夹下的 startup.cmd

浏览器访问

默认账号和密码:nacos

 

参考链接;

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网