新建/etc/mysql/myopt.cnf文件,并将改动部分写入该文件,之后在/etc/mysql/my.cnf中追加一句把这个文件include进来:

1
!include /etc/mysql/myopt.cnf

例如仅仅修改一下绑定地址和端口

1
2
3
4
# /etc/mysql/myopt.cnf
[mysqld]
bind-address = 0.0.0.0
port = 50006