2014-05-09 39 views
2

我已經加入這一行default_time_zone='+00:00'的/etc/my.cnf,但我收到此錯誤信息時重新啓動服務器:如何將MySQL服務器時區設置爲UTC?

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

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 
+0

請張貼cnf的相關部分。看起來像你在[]團隊 –

+1

這行應該插入到某個「部分」?就像[mysql] ?? –

+0

我發佈了答案,是的,它不是一個組的一部分,因此錯誤,將其下移到[mysqld]下並將下劃線改爲破折號(默認時區而不是default_time_zone) –

回答

5

它更改爲default-time-zone= default_time_zone並將其放入您的cnf的[mysqld]部分

相關問題