Syntax error How to change MySQL timezone?

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: 2019-07-30T22:30:23+05:30

367 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements