Home > Database > Mysql Tutorial > How to set MySQL time zone?

How to set MySQL time zone?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2023-08-26 11:05:02
forward
1430 people have browsed it

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();
Copy after login

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)
Copy after login

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

mysql> SET time_zone = "Some value";
Copy after login

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)
Copy after login

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)
Copy after login

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 of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template