java连接MYSQL80数据库驱动出现java.sql.SQLException:

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.
解决办法:
你原先的JDBCURL:jdbc:mysql://localhost:3306/mydatabase
在此基础上添加:?serverTimezone=UTC也就是:jdbc:mysql://localhost:3306/mydatabase?serverTimezone=UTC
但如果你的JDBCURL类似下面:

jdbc:mysql://localhost:3306/mydatabase?serverTimezone=UTC&characterEncoding=utf-8

就是有多个params的时候需要以&分开,但&要改为& 如下:

jdbc:mysql://localhost:3306/mydatabase?serverTimezone=UTC&characterEncoding=utf-8

猜你喜欢

转载自blog.csdn.net/weixin_43672855/article/details/86234057