How to change MySQL timezone?

MySQLMySQLi Database

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.

raja
Published on 20-Nov-2018 11:38:17
Advertisements