java.sql.SQLException: The server time zone value ‘�й���׼ʱ��’ is unrecognized or represents

Regarding the problem of Mybatis framework reporting errors

When using the Mybatis framework in IDEA today, I kept reporting errors during the final test. After checking for a long time, the test still failed to run successfully.
The error is as follows:
java.sql.SQLException: The server time zone value' й ׼ʱ ' is unrecognized or represents On the
Internet, it is said that Chinese comments cannot be used in xml files, and some say that high-level Mysql is in xml files. The value of useSSL in the url configuration in the url needs to be changed to false, and an error was reported after trying.
Insert picture description here

After thinking about it for a long time, I found out that it was a time zone problem. Because I mentioned in my previous blog that I changed the time zone to make IDEA successfully connect to the database, so I thought the time zone was fine at first.

Later, the time zone was modified and the program was running normally. The specific operations are as follows:
Insert picture description here

  • In the url end coupled serverTimezone = Asia / Shanghai to

Because the mysql I use is a new version starting with version 8 , the time zone issue has always been a pit. If you don’t want to be so troublesome, you can switch to the previous version starting with 5 .

  • By the way, here it is also a new version of the JDBC driver I'm using, so the driver of value is different at and before the old version of the driver, except that:

Insert picture description here

  • new version:
com.mysql.cj.jdbc.Driver
  • old version:
com.mysql.jdbc.Driver

Guess you like

Origin blog.csdn.net/weixin_45309636/article/details/108289602