2017-06-01 301 views
3

試圖訪問MySQL時,我收到以下錯誤:如何解決:mysql:[錯誤]在配置文件/etc/mysql/my.cnf中找到沒有前置組的選項?

的mysql:[錯誤]沒有在22行前面的組配置文件/etc/mysql/my.cnf找到的選項! mysql:[錯誤]默認處理中發生致命錯誤。程序中止!

/etc/mysql/my.cnf

# 
# The MySQL database server configuration file. 
# 
# You can copy this to one of: 
# - "/etc/mysql/my.cnf" to set global options, 
# - "~/.my.cnf" to set user-specific options. 
# 
# One can use all long options that the program supports. 
# Run program with --help to get a list of available options and with 
# --print-defaults to see which it would actually understand and use. 
# 
# For explanations see 
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html 

# 
# * IMPORTANT: Additional settings that can override those from this file! 
# The files must end with '.cnf', otherwise they'll be ignored. 
# 

!includedir /etc/mysql/conf.d/ 
!includedir /etc/mysql/mysql.conf.d/ 
bind-address = 127.0.0.1 
general_log_file = /var/log/mysql/mysql.log 
general_log = 1 

任何幫助,將不勝感激。

+0

第22行是您的綁定地址。這個問題 - 因爲我也擁有它 - 他們之前談論的是什麼? –

回答

2

在你的my.cnf所有選項必須是一個「羣」內,如:

[mysqld] 
bind-address 127.0.0.1 

在這個例子中的組是「mysqld的」。該組由命令前的一行命名,組的名稱在方括號中。

在開始給出選項之前,您的文件沒有任何已命名的組標識符。

閱讀https://dev.mysql.com/doc/refman/5.7/en/option-files.html瞭解如何格式化MySQL選項文件的更多細節。

相關問題