nacos启动时报错:/alibaba/nacos/config/server/monitor/MemoryMonitor.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'asyncNotifyService': Unsatisfied dependency expressed through field 'dumpService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'externalDumpService': Invocation of init method failed; nested exception is ErrCode:500, ErrMsg:Nacos Server did not start because dumpservice bean construction failure :
No DataSource set
网上查询都指出是application.properties文件下mysql设置有问题导致连接失败,设置的连接地址、用户名密码等没有问题。尝试了以下方法未解决:
1、db.url、db.user、db.password后面都加.0,即改为:db.url.0=jdbc:mysql://127.0.0.1:3306,db.user.0=root,db.password.0=123456。在前面配置中有db.num=1,加.0以后指定数据库序号。出错时已有该配置,未解决
2、db.url增加配置:&serverTimezone=UTC,指定时区;或调大超时时间:&connectTimeout=1000,尝试增加配置并调大时间为5000秒,未解决
3、本地mysql数据库为8.0,增加配置:db.driver-class-name=com.mysql.cj.jdbc.Driver,未解决
按以下方式解决:
db.url.0增加配置:&allowPublicKeyRetrieval=true,保存后重新启动nacos解决。
以下方式未尝试:
修改default_authentication_plugin设置,在my.ini中增加[mysqld]default_authentication_plugin=mysql_native_password,然后mysql命令行执行ALTER USER 'username'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';最后在url中添加时区参数serverTimezone=Asia/Shanghai。