1. 程式人生 > >[ERROR] Found option without preceding group in config file /etc/my.cnf at line 1!

[ERROR] Found option without preceding group in config file /etc/my.cnf at line 1!

今天碰到一個特別鬱悶的問題,啟動mysql資料庫時報錯:[ERROR] Found option without preceding group in config file /etc/my.cnf at line 1!經過查詢資料,說的都是:

原因:my.ini檔案格式是utf-8

解決辦法,my.ini檔案儲存為ANSI格式檔案

但是我的改了也沒有用處,後來才發現,不知道什麼時候,我刪除了一個#:

  For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html

[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
bind-address=192.168.1.229
log_bin=mysql-bin
log_slave_updates=1
gtid-mode=ON      #開啟GTID
enforce-gtid-consistency
"/etc/my.cnf" 35L, 1143C

錯誤詳情如下:

[[email protected] ~]# service mysqld start
my_print_defaults: [ERROR] Found option without preceding group in config file /etc/my.cnf at line 1!
my_print_defaults: [ERROR] Fatal error in defaults handling. Program aborted!
my_print_defaults: [ERROR] Found option without preceding group in config file /etc/my.cnf at line 1!
my_print_defaults: [ERROR] Fatal error in defaults handling. Program aborted!
my_print_defaults: [ERROR] Found option without preceding group in config file /etc/my.cnf at line 1!
my_print_defaults: [ERROR] Fatal error in defaults handling. Program aborted!
my_print_defaults: [ERROR] Found option without preceding group in config file /etc/my.cnf at line 1!
my_print_defaults: [ERROR] Fatal error in defaults handling. Program aborted!
my_print_defaults: [ERROR] Found option without preceding group in config file /etc/my.cnf at line 1!
my_print_defaults: [ERROR] Fatal error in defaults handling. Program aborted!
my_print_defaults: [ERROR] Found option without preceding group in config file /etc/my.cnf at line 1!
my_print_defaults: [ERROR] Fatal error in defaults handling. Program aborted!
Logging to '/var/lib/mysql/service1.err'.
MySQL Daemon failed to start.
正在啟動 mysqld:                                          [失敗]