WebHostingPeople Blog

  • Domains
    • Shared Hosting

  • Cloud VPS
  • Servers
    • Client Area Login

How Can We Help?

How to Change MySQL Server Time Zone

You are here:

This article will discuss how to modify the time zone of your MySQL server. Follow the steps below to change the time zone:

1) Log in to your server as the root user via SSH.

2) To find the current time zone of the MySQL server, execute the following command.

$ mysql  -e “SELECT @@global.time_zone;”

The output will be similar to the following:

@@global.time_zone

SYSTEM

Here, you can see that the MySQL time zone is currently set to “System”, which means it depends on the system time.

By default, the MySQL time zone is set to the server’s time zone. If you want to change the MySQL time zone, you can edit the /etc/my.cnf configuration file.

3) You can check the current time of the server using the following command:

$ date

The date command will return something like:

Mon Nov 26 12:50:07 EST 2017

4) You can check the current timestamp in MySQL by executing the following command:

$ mysql -e “SELECT NOW();”

The command will give back something like:

NOW()

2017-11-26 12:50:15

5) To change the MySQL time zone, edit the MySQL configuration file (/etc/my.cnf). Open the config file using your preferred text editor.

$ vi /etc/my.cnf

Then, add the time zone details to the bottom of the configuration file. For example:

default-time-zone = ‘-06:00’

6) Run the following command to check if the time zone has been changed.

$ mysql -e “SELECT @@global.time_zone;”

7) You should also check using the NOW function.

$ mysql -e “SELECT NOW();”

Now, let’s discuss how to change the server time zone via WHM.

 

Changing the Server Time Zone in WHM

1) Log in to WHM.

2) Click on the “Server Configuration” icon.

Timezone Change

3) Click on “Server Time”.

Server Time Zone

4) From the dropdown menu, select the desired time zone.

Server Time Zone

5) Click on “Sync Time with Time Server”.

Server Time Zone

If you need further assistance, please contact our support department.

Modifying the Time Zone in MySQL Server

Post Your Comment