The server time zone value ‘unknown’ is unrecognized or represents more than one time zone
Table of Contents
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
Hello! I am Narayanaswamy founder and admin of narayanatutorial.com. I have been working in the IT industry for more than 12 years. NarayanaTutorial is my web technologies blog. My specialties are Java / J2EE, Spring, Hibernate, Struts, Webservices, PHP, Oracle, MySQL, SQLServer, Web Hosting, Website Development, and IAM(ForgeRock) Specialist
I am a self-learner and passionate about training and writing. I am always trying my best to share my knowledge through my blog.