Import & Set Timezones in MySQL


To set the timezone for mysql (such as GMT) you may have to first import the timezones..

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql -p

Then add this to my.cnf and restart mysqld..
default-time-zone='timezone'

To see what timezones are currently used..
SELECT @@global.time_zone, @@session.time_zone;

Optional: To set/change timezone (after importing tz's as above)..
SET GLOBAL time_zone = timezone;


  Tags:

Looking for great online sysadmin training in Linux, Security & Hacking and many others?

Back