How to Change the MySQL Time Zone on an Ubuntu Server

How to Change the MySQL Time Zone on an Ubuntu Server

If you wish to explicitly set the time zone for your MySQL running on an Ubuntu Server, here is how to do it.

First open your global MySQL my.cnf configuration file:

sudo nano /etc/mysql/my.cnf

Scroll down the file to location the [mysqld_safe] section. Add the following line:

timezone = GMT

Obviously you would set it to what you wanted to use, be it UTC, GMT+2 or whatever. Save your changes and restart MySQL:

sudo service mysql restart

Done.

你可能感兴趣的:(server,ubuntu)