How to change timezone for MySQL on a cPanel server

Stop worrying about your server.

cPanel/Plesk Server Management for just $59/mo with Unlimited tickets, Unlimited admin hours, Security audits, 24×7 monitoring and lot more 

cPanel Server Management  $59/mo Click here

Plesk Server Management $59/mo Click here

How to change timezone for MySQL on a cPanel server:

For many of the websites there will be different time elements used for displaying time. It will use the server time this, but in some cases we need to have different time for the website and it is not possible to change the server time.

So in that case we can change the MySQL timezone to keep the website updated with the required timezone. For that first you need to know the function that will display the timezone for MySQL, it is the “MySQL NOW()” function that display the timezone. To check the current time using MySQL, you need to enter into the command line and call the “MySQL NOW()” function.

For Example;

[email protected] [~]# mysql -e "SELECT NOW()";
| NOW() |
| 2015-03-23 01:17:24 |
[email protected] [~]# date
Mon Mar 23 01:17:31 EDT 2015

The command,

mysql -e "SELECT NOW()";

will show the date and time set to mysql function.

So by modifying this function, you can set different time to your website. For that see the following examples to add various modifications to the function.

For increment 4 hours to the value of  “SELECT NOW()” function you can use syntax as follows,


And for decrease 4 hours from the current value, you need to use the syntax as follows,


That’s it

If you need our help to fix any issues on your server. Please feel free to contact us, simply email to [email protected]

Monthly server support with Unlimited tickets, 24×7 monitoring, Security Audit and lot more for just $59 

Server Management at just $59

Leave a Reply

Your email address will not be published. Required fields are marked *