Failed to set mysql timezone for madrid

According to this question on how to set time_zone in mysql and this timezone list , I should have this work:

SET time_zone = 'Europe/Madrid'; 

But this is what sqlBuddy writes:

The following errors were reported: Unknown or incorrect time zone: 'Europe / Madrid

+6
source share
2 answers

Be sure to fill in the timezone information tables. From mysql :

The value can be specified as the named time zone, for example, "Europe / Helsinki", "USA / East" or "MET". Named time zones can only be used if time zone information tables have been created and populated in the mysql database.

Although I prefer to store all dates in UTC. I find this makes the reasoning a lot easier, especially when daylight saving time is introduced.

+5
source

An alternative solution if you do not want to create your own time zone settings tables.

If you have your own server, leave MySQL as it is. The default time zone is SYSTEM .

Ubuntu users can use

 dpkg-reconfigure tzdata 

For more conservative OS ( Centos, RedHat, Fedora ) use

 tzconfig 

to change the system time zone. The CLI application will appear in which you can select the region and location. These are not only two birds with one stone, but also automatically take into account daylight changes, without indicating when and what in the MySQL time zone tables.

enter image description here

Remember to restart the MySQL server for the change to take effect.

+1
source

Source: https://habr.com/ru/post/919686/


All Articles