Spring Boot:Unable to open JDBC connection for schema management target

来源:互联网 发布:学会编程能做什么 编辑:程序博客网 时间:2024/06/07 15:57

启动Spring Boot工程时出现了这个错误,表示无法建立JDBC连接,肯定首先是想到数据库的连接出了问题,Spring Boot在启动时会检查数据库的连接是否正常,所以在这里会报错,这里使用了Mysql数据源,配置信息:

# MYSQL DATASOURCE CONFIGspring.datasource.url=jdbc:mysql://localhost:3306/testspring.datasource.username=rootspring.datasource.password=rootspring.datasource.driverClassName=com.mysql.jdbc.Driverspring.jpa.database=MYSQLspring.jpa.show-sql=truespring.jpa.hibernate.ddl-auto=updatespring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategyspring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect

发现用户名和密码都正常,去MYSQL下查看,居然是没有数据库test的问题。所以只需要新建test数据库即可:

CREATE DATABASE IF NOT EXISTS test DEFAULT CHARSET utf8 COLLATE utf8_general_ci;

这里出现的问题一定是在JDBC的连接上,所以对症下药,检查数据库的配置信息,可能是用户名密码不匹配啊,数据库链接写得不对啊,或者数据库没有启动啊,都是有可能的。

阅读全文
0 0
原创粉丝点击