我正在尝试在我的 MySQL 服务器上启用日志,但没有成功。我做了什么 :
1)我创建了具有正确权限的日志文件:
touch /var/log/mysql/mysql.log
chown mysql:mysql /var/log/mysql/mysql.log
2)我已将所需的更改添加到my.cnf
文件中:
general_log_file = /var/log/mysql/mysql.log
general_log = 1
我的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/
general_log_file = /var/log/mysql/mysql.log
general_log = 1
我无法重新启动 MySQL,当我尝试记录时,出现此错误:
错误:在配置文件中找到没有前组的选项:/etc/mysql/my.cnf 在行:23 默认处理中的致命错误。程序中止
这是什么意思,我该如何解决这个问题?
我正在使用带有MySQL 5.6.24-0ubuntu2的Ubuntu 15.05