7.04-springboot链接数据库启动报错

  

部分异常信息以下:java

2018-12-05 17:00:19.810 ERROR 10908 --- [eate-1708786164] com.alibaba.druid.pool.DruidDataSource   : create connection SQLException, url: jdbc:mysql://localhost:3306/db_dev_project?allowMultiQueries=true, errorCode 0, state 01S00

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

 

致使的缘由:mysql

因为mysql:mysql-connector-java 的版本问题致使的sql

mysql-connector-java 5             :     使用的是    com.mysql.jdbc.Driver数据库

mysql-connector-java 6及以上   :     使用的是    com.mysql.cj.jdbc.Driver      与5不一样的是链接数据库时,必须指定时区 serverTimezone ,不然就会报上面的错误ui

 

正确代码以下:url

            driverClassName=com.mysql.cj.jdbc.Driverspa

            url=jdbc:mysql://localhost:3306/test?characterEncoding=UTF-8&serverTimezone=UTC&useSSL=falsecode

            username=rootserver

            password=******io

相关文章
相关标签/搜索