The server time zone value unknown is unrecognized or represents more than one time zone

The server time zone value ‘unknown’ is unrecognized or represents more than one time zone

SQL Exception while inserting data into table: The server time zone value ‘unknown’ 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.

 

JDBC URL With Time Zone

You need to set the time zone in MySQL server JDBC URL while trying to connect MySQL from java.

serverTimezone=UTC

 Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost/identityiq?serverTimezone=UTC","root","Admin1234");

 

MySQL Global Configuration for Time Zone

You can set timezone in the MySQL global configuration

 

SET GLOBAL time_zone = '+5:00';

 

MySQL global configuration file path

<Installation Directory>/mysql/mysql.conf.d/mysqld.cnf

Leave a Reply