Springboot version upgrade leads to database connection error: The server time zone value 'Öйú ± ê × ¼Ê ± ¼ä' is unrecognized

    As shown in the title, when we use springboot version higher than 2.1.4.RELEASE, the database driver becomes com.mysql.cj.jdbc.Driver by default instead of the original com.mysql.jdbc.Driver, which is also directly As a result, an error message will occur after connecting to the database:

    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.

     The solution is to set a serverTimezone parameter for the database connection url. The value can be GMT-8 or Asia / Shanghai, because GMT-8 needs to escape the hyphen "-", so the configuration property is serverTimezone = GMT% 2B8 , If it is Asia / Shanghai, there is no need to do conversion.

     

     

Published 529 original articles · praised 287 · 1.47 million views

Guess you like

Origin blog.csdn.net/feinifi/article/details/103836362