16

My problem

MySQL connector "The server time zone value Central European Time" is unrecognized or represents more than one time zone.

The project

Small web Project with: JavaEE, Tomcat 8.5, MySQL, Maven

My attempt

  • Maven -> change MySQL-connector form 6.x to 5.1.39 (no change)
  • Edit context.xml URL change

Connection in context.xml

URL="jdbc: mysql://127.0.0.1:3306/rk_tu_lager?useLegacyDatetimeCode=false;serverTimezone=CEST;useSSL=false;

Error:

Caused by: com.mysql.cj.core.exceptions.InvalidConnectionAttributeException: The server time zone value 'Mitteleurop?ische Sommerzeit' 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.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Martin Klestil
  • 574
  • 1
  • 4
  • 15

4 Answers4

20

Thank you Mark Rotteveel and Gord Thompson

I have the connection in an XML file, with & and Europe/Amsterdam finally works.

url="jdbc:mysql://127.0.0.1:3306/rk_tu_lager?useLegacyDatetimeCode=false&serverTimezone=Europe/Amsterdam&useSSL=false"

Thank you, you are great

user871611
  • 3,307
  • 7
  • 51
  • 73
Martin Klestil
  • 574
  • 1
  • 4
  • 15
  • 2
    Had the same problem in DataGrip and could solve it using a similar setting value. Setting it to `serverTimezone=Europe/Berlin` got me rid of the warning on connect. – SaschaM78 Jun 20 '19 at 12:30
10

I faced this issue when I upgraded my mysql server to SQL Server 8.0 (MYSQL80).

The simplest solution to this problem is just write the below command in your MYSQL Workbench -

  SET GLOBAL time_zone = '+5:30'

The value after the time-zone will be equal to GMT+/- Difference in your timezone. The above example is for India(GMT+5:30). It will solve the issue.

vikash singh
  • 1,479
  • 1
  • 19
  • 29
8

Find what is the timezone you are in and replace +00:00 with your timezone.

SET @@global.time_zone = '+00:00';
SET @@session.time_zone = '+00:00';

Then check if the values were set:

SELECT @@global.time_zone, @@session.time_zone;

SELECT result

Cédric
  • 334
  • 2
  • 8
JasonLi
  • 101
  • 1
  • 2
2

If you are using MySQL client eg. DBeaver you should change settings of your connection. So, click right click mouse on the connection and click Edit Connection. Then, edit your driver properties which are located under the "Connection settings", go to the bottom of settings and click "Add new property", add serverTimezone as your new property name and enter value eg. Europe/Warsaw. That's all.

corey
  • 300
  • 1
  • 16