项目场景:
Mysql 启动报错:
mysqld: [ERROR] Found option without preceding group in config file /etc/my.cnf at line 1!
# 启动mysql
systemctl start mysqld

问题描述:
# 查看启动日志
journalctl -xe
Sep 03 15:10:09 cluster-node-1 mysqld_pre_systemd[17180]: my_print_defaults: [ERROR] Found option without preceding group in config file /etc/my.cnf
Sep 03 15:10:09 cluster-node-1 mysqld_pre_systemd[17180]: my_print_defaults: [ERROR] Fatal error in defaults handling. Program aborted!
Sep 03 15:10:09 cluster-node-1 mysqld_pre_systemd[17180]: my_print_defaults: [ERROR] Found option without preceding group in config file /etc/my.cnf
Sep 03 15:10:09 cluster-node-1 mysqld_pre_systemd[17180]: my_print_defaults: [ERROR] Fatal error in defaults handling. Program aborted!
Sep 03 15:10:09 cluster-node-1 mysqld[17198]: mysqld: [ERROR] Found option without preceding group in config file /etc/my.cnf at line 1!
Sep 03 15:10:09 cluster-node-1 mysqld[17198]: mysqld: [ERROR] Fatal error in defaults handling. Program aborted!
Sep 03 15:10:09 cluster-node-1 systemd[1]: mysqld.service: control process exited, code=exited status=1
Sep 03 15:10:09 cluster-node-1 systemd[1]: Failed to start MySQL Server.
原因分析:
mysql配置文件编码格式有误!
Mysql配置文件:/etc/my.cnf
在使用win下编辑器配置 my.cnf 时,导致文件编码格式改变。
解决方案:
使用编辑器打开 my.cnf
点击 编码(N)
选择 使用 UTF-8 编码
ctrl + s 保存即可
# 重启mysql
systemctl restart mysqld
# 查看mysql状态
systemctl status mysqld

在尝试启动Mysql时遇到错误:mysqld: [ERROR] Found option without preceding group in config file /etc/my.cnf at line 1! 该问题源于配置文件的格式不正确。通过检查并修正my.cnf文件中的配置项归属,确保每一选项都在正确的分组下,可以成功解决此启动错误。

990

被折叠的 条评论
为什么被折叠?



