Friday, March 05, 2010

MySQL timezone setting for IST

Normally on US based servers, default US timezone is used, when creating DateTime in mysql. If your application is served to only India based customers then better to set mysql timezone to show Indian time.

check time_zone* tables in mysql db. if they are empty fill them using following command

shell> mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql

Zone Info database on system.
Such systems are Linux, FreeBSD, Solaris, and Mac OS X. One likely location for these files is the /usr/share/zoneinfo directory.

mysql>SET GLOBAL time_zone = "Asia/Calcutta";


This blog is writter based on info from mysql website .

4 comments:

mkurikkal said...

mysql>SET GLOBAL time_zone = '+05:30';

worked for me.

dileep said...

Can i have any option to change session timezone to IST. i tried as set time_zone='IST'. i does not work.
And dont want to do set time_zone='asia/kolkatta';

Please say an alternative.

dileep said...

Can i have any option to change session timezone to IST. i tried as set time_zone='IST'. i does not work.
And dont want to do set time_zone='asia/kolkatta';

Please say an alternative.

dharam said...

Thanks a lot. Worked for me.