报错

配置好了nacos的application.properties,成功启动了mysql,运行nacos的mysql脚本生成了对应的数据库。启动nacos连接mysql时报错。
在这里插入图片描述在这里插入图片描述

报错: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.)

环境

nacos-1.1.4; mysql-8.0.20; centos-8;

原因

nacos自带mysql-connection版本过低

解决

在nacos目录下新建/plugins/mysql目录,将mysql对应版本的mysql-connection的jar包放到该文件夹中。
在这里插入图片描述
移动jar包后目录结构
在这里插入图片描述
重新启动nacos 查看start.out日志文件
在这里插入图片描述
结果 nacos成功启动
在这里插入图片描述

参考

nacos以mysql8.0.x为数据源出现的一些问题:https://blog.csdn.net/qq_32628775/article/details/86609739.
解决Nacos无法连接Mysql8.0+的问题:https://blog.csdn.net/w1529132313/article/details/105604629/.

Logo

AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。

更多推荐