Sometimes your MySQL database’s timezone is set to UTC time by default and does not follow your local timezone. In this case, you’ll need to manually change its configuration.
The configuration file can usually be found in mysql folder, which, depends on the operating system you’re running, could be installed in different directory.
Linux & Mac:
- C:/Program Files/MySQL/MySQL Server 4.1/my.ini
Once you found the config file, open it up with text editor and add this line to the end of the file:
default-time-zone = '+08:00'
In this example, I’m change the time zone to GMT+8.
Next, you need to restart MySQL in order to see the effect. You could do so by opening up command prompt and type in this command:
sudo service mysql restart
net stop MySQL net start MySQL
sudo /usr/local/mysql/support-files/mysql.server restart
Now your MySQL should run in the correct time zone!