首页 > 其他 > 详细

毕设问题记录

时间:2019-05-15 15:22:53      阅读:133      评论:0      收藏:0      [点我收藏+]

Spring Boot 连接 MySQL 数据库

application.properties文件配置:

#配置数据库
spring.datasource.url= jdbc:mysql://127.0.0.1:3306/demo01
spring.datasource.username= root
spring.datasource.password= root
spring.datasource.driver-class-name= com.mysql.jdbc.Driver

参考:常用数据库JDBC URL格式

 

//错误
Loading class `com.mysql.jdbc.Driver‘. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver‘. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.

原因:MySQL连接驱动更新了。

//异常
java.sql.SQLException: The server time zone value ‘Öйú±ê׼ʱ¼ä‘ is unrecognized or represents more than one time 

原因:未指定时区serverTimezone,GMT%2B6为东八区,即中国时区。

修改后配置为:

#配置数据库
spring.datasource.url= jdbc:mysql://127.0.0.1:3306/demo01?serverTimezone=GMT%2B8
spring.datasource.username= root
spring.datasource.password= root
spring.datasource.driver-class-name= com.mysql.cj.jdbc.Driver

 

毕设问题记录

原文:https://www.cnblogs.com/picheng/p/10769046.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!