wilwei

MySQL驱动6.X的几个问题

1,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.jdbc.Driver已经过时 改为com.mysql.cj.jdbc.Driver

2,java.sql.SQLException: 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.
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:695)

需要在Url后面添加一个参数:

?serverTimezone=UTC

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

url中localhost:3306 可以省略 直接写成url=jdbc:mysql:///test?serverTimezone=UTC


使用最新驱动url请加上

jdbc:mysql://localhost:3306/shiro?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC

不然有很多坑...

评论