Problems with MySQL and timezones


I’m having a lot of trouble getting my timezone to work properly in MySQL. I’ve tried doing a:
set time_zone = 'Australia/Sydney’
from mysql and I get the message:
ERROR 1298 (HY000): Uknown or incorrect time zone: Australia/Sydney
I know this time zone is correct because I’m using it in linux & php (ie. export TZ=‘Australia/Sydney’), and I’ve tried using other timezone names and get the same message.
Anyone know why this isn’t working?


Take a look at this thread to see how to do it with .htaccess:

Or you can try the following PHP code:

putenv('TZ= Australia/Sydney'); //format the timezone for SQL $timeZone = preg_replace('/([+-]\d{2})(\d{2})/', '\'\1:\2\'', date('O')); mysql_query('SET time_zone='.$timeZone); (from

hope that helps