启动微服务出现 com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'cloud_user’报错,网上也有找相关从错误解决:
1.是不是多个myql的启动原因
2.或者防火墙的问题
3.代码上的的注解问题。
上面方法试了还是不行,终究细致的找下去发现我这边的报错原因是:**数据库名称和微服务的服务配置yaml中url没对应上,**修改后成功启动
. ____ _ __ _ _
/\ / ’ __ _ () __ __ _ \ \ \
( ( )__ | '_ | '| | ’ / ` | \ \ \
\/ )| |)| | | | | || (| | ) ) ) )
’ || .__|| ||| |_, | / / / /
=========||==============|/=////
:: Spring Boot :: (v2.3.9.RELEASE)
07-13 12:45:26:919 INFO 52516 — [ main] c.a.n.c.c.impl.LocalConfigInfoProcessor : LOCAL_SNAPSHOT_PATH:C:\Users\w\nacos\config
07-13 12:45:26:921 INFO 52516 — [ main] c.a.nacos.client.config.impl.Limiter : limitTime:5.0
07-13 12:45:26:934 WARN 52516 — [ main] c.a.c.n.c.NacosPropertySourceBuilder : Ignore the empty nacos configuration and get it based on dataId[userservice] & group[DEFAULT_GROUP]
07-13 12:45:26:934 WARN 52516 — [ main] c.a.c.n.c.NacosPropertySourceBuilder : Ignore the empty nacos configuration and get it based on dataId[userservice.yaml] & group[DEFAULT_GROUP]
07-13 12:45:26:934 WARN 52516 — [ main] c.a.c.n.c.NacosPropertySourceBuilder : Ignore the empty nacos configuration and get it based on dataId[userservice-dev.yaml] & group[DEFAULT_GROUP]
07-13 12:45:26:934 INFO 52516 — [ main] b.c.PropertySourceBootstrapConfiguration : Located property source: [BootstrapPropertySource {name=‘bootstrapProperties-userservice-dev.yaml,DEFAULT_GROUP’}, BootstrapPropertySource {name=‘bootstrapProperties-userservice.yaml,DEFAULT_GROUP’}, BootstrapPropertySource {name=‘bootstrapProperties-userservice,DEFAULT_GROUP’}]
07-13 12:45:26:966 INFO 52516 — [ main] cn.itcast.user.UserApplication : The following profiles are active: dev
07-13 12:45:27:235 INFO 52516 — [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=681eea17-adf5-3b14-9746-ef66bdf9ef45
07-13 12:45:27:385 INFO 52516 — [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8082 (http)
07-13 12:45:27:392 INFO 52516 — [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
07-13 12:45:27:392 INFO 52516 — [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.43]
07-13 12:45:27:471 INFO 52516 — [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
07-13 12:45:27:471 INFO 52516 — [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 505 ms