Skip navigation

This shouldn’t have taken me as long as it did, but Java’s JDBC driver doesn’t always know what TZ to use or rejects what the system returns. You may see something like: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (The server time zone value 'CDT' 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.)

Yes, the mis-spelling of ‘specific’ is accurate to the output as out OpenJDK 1.8.0_181

You can attempt to push the TZ from the Java application but there’s no good reason the MySQL server shouldn’t be configured with a TZ. Check the server with:
SELECT @@global.time_zone

Then update /etc/myc.cnf with default-time-zone=Your/Timezone and restart.

If the server refuses to start and your sure of your timezone in my.cnf the MySQL tables might not be fully populated, to do so execute mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql -p from a terminal on the server host.

MySQL Documentation on Default Timezone