How to change MySQL timezone?


To change the timezone in MySQL, we can use the SET command. The following is the syntax.

SET time_zone=’someValue’;

Let us now use the above syntax and apply it in the below query.

mysql > SET time_zone = '+8:00';
Query OK, 0 rows affected (0.00 sec)

Above, the time_zone is changed by a value equivalent to 8. To change the timezone globally, use the GLOBAL command. Here is the syntax.

SET GLOBAL time_zone = 'someValue';

Here is an example.

mysql> SET GLOBAL time_zone = '+8:00';
Query OK, 0 rows affected (0.00 sec)

The above query will change the timezone globally.

Updated on: 30-Jul-2019

288 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements