Home>Article>Database> How to set MySQL time zone?

How to set MySQL time zone?

WBOY
WBOY forward
2023-08-26 11:05:02 1224browse

How to set MySQL time zone?

To know the current time, we can use the now() function and the SELECT statement. The query is As follows -

mysql> SELECT now();

After executing the above query, we will get the current time. The following is the output-

+---------------------+ | now() | +---------------------+ | 2018-10-06 12:57:25 | +---------------------+ 1 row in set (0.02 sec)

To set the time zone, we can use the command SET. The syntax is as follows-

mysql> SET time_zone = "Some value";

Now I am applying the above query to set the time zone. The The query is as follows-

mysql> SET time_zone = "+9:50"; Query OK, 0 rows affected (0.00 sec)

We can also use the SET command to perform global settings-

mysql> set global time_zone="+9:00"; Query OK, 0 rows affected (0.00 sec)

The above is the detailed content of How to set MySQL time zone?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete