如何修复:mysql:[错误] 在配置文件/etc/mysql/my.cnf 中找到没有前面组的选项? [英] How to fix: mysql: [ERROR] Found option without preceding group in config file /etc/mysql/my.cnf?

查看:470
本文介绍了如何修复:mysql:[错误] 在配置文件/etc/mysql/my.cnf 中找到没有前面组的选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试访问 mysql 时出现以下错误:

<块引用>

mysql: [错误] 在配置文件/etc/mysql/my.cnf 的第 22 行找到没有前面组的选项!mysql: [错误] 默认处理中的致命错误.程序中止!

/etc/mysql/my.cnf

<预><代码>## MySQL 数据库服务器配置文件.## 您可以将其复制到以下之一:# - "/etc/mysql/my.cnf" 设置全局选项,# - "~/.my.cnf" 设置用户特定的选项.## 可以使用程序支持的所有长选项.# 使用 --help 运行程序以获取可用选项列表,并使用# --print-defaults 以查看它实际理解和使用的内容.## 解释见# http://dev.mysql.com/doc/mysql/en/server-system-variables.html## * 重要提示:可以覆盖此文件中的设置的其他设置!# 文件必须以'.cnf'结尾,否则会被忽略.#!includedir/etc/mysql/conf.d/!includedir/etc/mysql/mysql.conf.d/绑定地址 = 127.0.0.1general_log_file =/var/log/mysql/mysql.loggeneral_log = 1

任何帮助将不胜感激.

解决方案

my.cnf 中的所有选项都需要在一个组"中,例如:

[mysqld]绑定地址 127.0.0.1

这个例子中的组是mysqld".组由选项前的一行命名,组名在方括号中.

在您开始提供选项之前,您的文件没有任何命名的组标识符.

阅读https://dev.mysql.com/doc/refman/5.7/en/option-files.html 有关如何格式化 MySQL 选项文件的更多详细信息.

I am getting the following error when trying to access mysql:

mysql: [ERROR] Found option without preceding group in config file /etc/mysql/my.cnf at line 22! mysql: [ERROR] Fatal error in defaults handling. Program aborted!

/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

Any help would be appreciated.

解决方案

All options in your my.cnf need to be within a "group" like:

[mysqld]
bind-address 127.0.0.1

The group in this example is "mysqld". The group is named by a line preceding the options, and the name of the group is in square brackets.

Your file doesn't have any group identifier named before you start giving options.

Read https://dev.mysql.com/doc/refman/5.7/en/option-files.html for more details on how to format MySQL option files.

这篇关于如何修复:mysql:[错误] 在配置文件/etc/mysql/my.cnf 中找到没有前面组的选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆