nacos版本2.0.1、mysql版本8.0.35
本地搭建环境遇到nacos无法连接数据库问题,找了很多方法才成功
启动nacos一直提示各种错误:
1.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.
2.com.mysql.cj.exceptions.CJException: Public Key Retrieval is not allowed 主要是这个问题导致
3.Error creating bean with name 'memoryMonitor' defined in URL
主要是提示以上几个错误信息,主要的原因是第二点
解决方法:
在mysql连接的url最后加上allowPublicKeyRetrieval=true