How To Change Time Zone In MYSQL

May 2, 2013 | By in LINUX HOWTO
| Reply More

Linux commands

This article is all about changing time zone in MySql. If mysql time zone is not correct, if different from your time zone, you can change it by following steps.

Check current mysql time zone

You should check the current time as below

Login to mysql with root user, run below command



#mysql -u root -p

Enter root password:

mysql> SELECT NOW();

| NOW() |
| 2013-05-01 06:43:52 |
1 row in set (0.00 sec)

Change Timezone

Stop mysql service

service mysqld stop

shutting down mysqld ................. OK

Check time_zone tables in mysql db. If it is empty then fill them using below command.

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql

if you have set root password then:

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql -p

Execute below command as root user to change timezone

mysql> SET GLOBAL time_zone = timezone;


mysql> SET GLOBAL time_zone = “Asia/Calcutta”;

The above command will set the timezone to Asia/Calcutta globally. You can change the time zone as per your timezone.

Start mysql service

service mysqld start

starting mysqld ............. OK


Share This :

Free Linux Ebook to Download

Leave a Reply

Commenting Policy:
Promotion of your products ? Comment gets deleted.
All comments are subject to moderation.