How do I set the time zone of MySQL?

后端 未结 20 3284
闹比i
闹比i 2020-11-21 07:07

On one server, when I run:

mysql> select now();
+---------------------+
| now()               |
+---------------------+
| 2009-05-30 16:54:29 |
+---------         


        
20条回答
  •  灰色年华
    2020-11-21 07:33

    You can specify the server's default timezone when you start it, see http://dev.mysql.com/doc/refman/5.1/en/server-options.html and specifically the --default-time-zone=timezone option. You can check the global and session time zones with

    SELECT @@global.time_zone, @@session.time_zone;
    

    set either or both with the SET statement, &c; see http://dev.mysql.com/doc/refman/5.1/en/time-zone-support.html for many more details.

提交回复
热议问题