简体   繁体   English

如何将MySQL服务器时区设置为UTC?

[英]How can I set MySQL server timezone to UTC?

I have added this line default_time_zone='+00:00' into /etc/my.cnf , but I get this error message when restart server: 我已将以下行default_time_zone='+00:00'/etc/my.cnf中 ,但是重新启动服务器时出现以下错误消息:

error: Found option without preceding group in config file: /etc/my.cnf

UPDATE UPDATE

# MySQL programs look for option files in a set of
# locations which depend on the deployment platform.
# You can copy this option file to one of those
# locations. For information about these locations, see:
# http://dev.mysql.com/doc/mysql/en/option-files.html
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.

default_time_zone = "+00:00"

# The following options will be passed to all MySQL clients
[client]
#password       = your_password
port            = 3306
socket          = /tmp/mysql.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
port            = 3306

将其从default_time_zone更改为default-time-zone=并将其放置在cnf的[mysqld]部分中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM