The server time zone value 'Öйú

2018-11-10  本文已影响0人  LAMYMAY

mysql默认服务器时区问题:修改jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8为

jdbc:mysql://localhost:3306/test?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8

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.

字面意思 mysqljdbc . driver。这是被弃用的。新的驱动类是“com.mysql.cjdbc.driver”。驱动程序通过SPI自动注册,而手动加载类通常是不必要的。

那么我只需要把 com.mysql.jdbc.Driver 改为com.mysql.cj.jdbc.Driver 即可

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

从错误上看应该是时区的错误,因此只需要设置为你当前系统时区即可

static final  String DB_URL="jdbc:mysql://localhost:3306/csm"+"?serverTimezone=GMT%2B8";

加上?serverTimezone=GMT%2B8" 即可  GMT%2B8代表: 东八区

GMT%2B8代表是东八区

---------------------

上一篇 下一篇

猜你喜欢

热点阅读