欢迎光临
我们一直在努力

java 连接 MySQL 数据库出现时区错误:The server time zone value‘???ú±ê×??±??’ is unrecognized or represents…

错误信息:

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.

出错的原因:
MySQL server 的时区和本地时区不符合

解决方法:

在连接数据库的url后面加上serverTimezone=GMT%2B8
eg:

jdbc:mysql://localhost:3306/database?

变为:

jdbc:mysql://localhost:3306/database?serverTimezone=GMT%2B8
赞(0)
版权归原作者所有,如有侵权请告知。达维营-前端网 » java 连接 MySQL 数据库出现时区错误:The server time zone value‘???ú±ê×??±??’ is unrecognized or represents…

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址