Tuesday 17 September 2013

Mysql setting the different timezone as default

When you install mysql it uses system time zone as a default time zone, and you may need to specify the different timezone as a default time zone.

1. stop the msql server

2. Go to http://dev.mysql.com/downloads/timezones.html and download "POSIX standard Time zone description tables, version 2011n"

3. unzip "timezone_2011n_posix.zip", copy and paste the files where mysql is installed, on my machine for windows its "C:\ProgramData\MySQL\MySQL Server 5.5\data\mysql"

4. Edit my.ini, for windows its where you have installed mysql, on my windows machine its at "C:\ProgramData\MySQL\MySQL Server 5.5", and add the following entry at the end:
 default-time-zone = UTC

5. Save my.ini

6. Restart the mysql server.

7.  Run the following query to check if the timezone is set to what you are after.
SELECT @@global.time_zone

Note: If you allready have the latest timezone files from the url mentioned in the step 2, you can skip step 2 and 3.

No comments:

Post a Comment