Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix server time zone causing exception when trying to connect to MySQL instance with DataGrip?

When attempting to connect to a MySQL instance with DataGrip I am receiving a com.mysql.cj.exceptions.InvalidConnectionAttributeException exception:

The server time zone value 'XXX' 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.

Where XXX is my server's timezone (I also love the typo in the exception specifc). This error prevents me from creating a connection to the MySQL server. What is causing this issue?

like image 241
ahsteele Avatar asked Apr 25 '19 21:04

ahsteele


2 Answers

Your server's time zone is not specific. To get around this you need to set the serverTimezone property to a value that is specific. The simplest choice is to set it to UTC under the Advanced tab:

Advanced Tab serverTimeZone set

To be clear I'm not sure of the ramifications of this, but it did allow me to connect.

like image 121
ahsteele Avatar answered Oct 10 '22 23:10

ahsteele


I encountered the same problem, I tried to replace the driver with 5.1, and the connection was successful:

MySQL 5.1 driver

like image 25
user12549242 Avatar answered Oct 10 '22 21:10

user12549242