MySQL uses zoneinfo names -- based on political subdivisions -- to name timezones. These look like 'Europe/Helsinki'
or 'Europe/Athens'
rather than generic names. Why? zoneinfo attempts to handle both daylight and standard time, and those rules depend on said political subdivisions.
All this zoneinfo stuff is built into UNIX-derived operating systems, so MySQL servers running on Linux transparently use those timezones. Zoneinfo is not built into Windows, so if your MySQL server runs there, you must set up the server timezone lookup tables yourself, with this procedure.
You can set the MySQL default server timezone in a number of ways. Look up how to do these. These are a few of the ways.
- In my.cnf, MySQL's configuration file.
- On your JDBC connection string add a parameter like
&serverTimezone=Europe/Helsinki
- Once you have established your MySQL connection give the SQL command
SET time_zone='Europe/Helsinki'
(or whatever you require).
You can also set this up in your Java program. Look up how to do that.
MySQL's internal TIMESTAMP
data type, and the values of functions like NOW()
, are inherently in UTC. But MySQL translates them from UTC to your chosen timezone on display, and translates them to UTC upon storing.
So, in many applications (WordPress for example) the timezone setting is a user preference.