您的位置:首页 > 数据库 > MySQL

mysql5.6连接遇到的问题

2017-08-02 11:30 309 查看
maven项目 springcloud的demo
spring-mybatis整合 mysql数据库5.6

1.   Caused by: java.lang.IllegalStateException: Cannot load driver class:
org.gjt.mm.mysql.Driver

改为   com.mysql.jdbc.Driver后,出现如下提示:

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.


最终改为: com.mysql.cj.jdbc.Driver

2.  Caused by: com.mysql.cj.core.exceptions.InvalidConnectionAttributeException: The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration
property) to use a more specifc time zone value if you want to utilize time zone support.

在数据库连接的url后加上  ?serverTimezone=UTC

示例: application.yml中关于数据源配置

spring:

  datasource:

    type: com.alibaba.druid.pool.DruidDataSource

    driver-class-name: com.mysql.cj.jdbc.Driver

    url: jdbc:mysql://localhost:3306/db8001?serverTimezone=UTC

    username: root

    password: 123456
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mysql