How To Change Time Zone In MYSQL

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

Bobbin Zachariah 11:17 am

About Bobbin Zachariah

Founder of LinOxide, passionate lover of Linux and technology writer. Started his career in Linux / Opensource from 2000. Love traveling, blogging and listening music. Reach Bobbin Zachariah about me page and google plus page.

Author Archive Page

Have anything to say?

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

All comments are subject to moderation.