如何设置MySQL的时区?

WBOY
WBOY 转载
2023-08-26 11:05:02 311浏览

如何设置MySQL的时区?

要知道当前时间,我们可以使用 now() 函数和 SELECT 语句。查询是 如下 -

mysql> SELECT now();

执行上述查询后,我们将获得当前时间。以下是输出 -

+---------------------+
| 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 如下 -

mysql> SET time_zone = "Some value";

Now I am applying the above query to set the time zone. The query is 如下 -

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

我们也可以借助 SET 命令进行全局设置 -

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

以上就是如何设置MySQL的时区?的详细内容,更多请关注php中文网其它相关文章!

声明:本文转载于:tutorialspoint,如有侵犯,请联系admin@php.cn删除