How do I set the time zone of MySQL?

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

    Ancient question with one more suggestion:

    If you've recently changed the timezone of the OS, e.g. via:

    unlink /etc/localtime
    ln -s /etc/usr/share/zoneinfo/US/Eastern /etc/localtime
    

    ... MySQL (or MariaDB) will not notice until you restart the db service:

    service mysqld restart
    

    (or)

    service mariadb restart
    
    0 讨论(0)
  • 2020-11-21 07:45

    If you are using the MySql Workbench you can set this by opening up the administrator view and select the Advanced tab. The top section is "Localization" and the first check box should be "default-time-zone". Check that box and then enter your desired time zone, restart the server and you should be good to go.

    0 讨论(0)
提交回复
热议问题