/etc/my.cnf - 我错过了什么?

Man*_*dar 5 mysql linux

我收到以下错误:

error: Found option without preceding group in config file: /etc/my.cnf at line: 1
Fatal error in defaults handling. Program aborted
Run Code Online (Sandbox Code Playgroud)

这是我的 /etc/my.cnf 文件:

[root@host backup]#cat /etc/my.cnf
max_allowed_packet=100M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[mysqldump]
max_allowed_packet=100M
Run Code Online (Sandbox Code Playgroud)

gra*_*oot 11

添加[mysqld]my.cnf-file的第一行。