How do I set the time zone of MySQL?

后端 未结 20 3279
闹比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:31

    Edit the MySQL config file

    sudo nano /etc/mysql/my.cnf
    

    Scroll and add these to the bottom. Change to relevant time zone

    [mysqld]
    default-time-zone = "+00:00"
    

    Restart the server

    sudo service mysql restart
    

提交回复
热议问题