相信很多同学用nacos配置mysql时都遇到了这个报错(No DataSource set)
2022-01-22 10:23:25,063 ERROR Application run failed
: Error creating bean with name 'memoryMonitor' defined in URL [jar:file:/F:/Environment/nacos-server-2.0.3/target/!/BOOT-INF/lib/nacos-config-2.0.!/com/alibaba/nacos/config/server/monitor/]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is : Error creating bean with name 'asyncNotifyService': Unsatisfied dependency expressed through field 'dumpService'; nested exception is : 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
先简单总结一下nacos配置mysql步骤:
- 新建数据库nacos_config, 执行sql脚本生成表单
- 在下配置mysql相关属性
- 启动
一般都是在配置文件时出了问题, 如果直接照抄官方文档会报错, 因为mysql8.0之后的版本, 需要在官网文档配置mysql的基础上加上mysql时区的设置
正确的配置如下:
=mysql
=1
.0=jdbc:mysql://127.0.0.1:3306/nacos_config?characterEncoding=utf8&serverTimezone=UTC&connectTimeout=1000&socketTimeout=3000&autoReconnect=true
=我的mysql用户名
=我的密码
启动成功!