mysql commercial community,MySQL 5.6.20-enterprise-commercial的参数文件位置问题

今天在折腾MySQL的参数文件时,突然发现MySQL 5.6.20-enterprise-commercial-advanced-log这个版本数据库的参数文件my.cnf的位置有点奇怪,如下所示:

[root@DB-Server ~]# mysql --help | grep my.cnf

order of preference, my.cnf, $MYSQL_TCP_PORT,

/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf

[root@DB-Server ~]# ls -lrt /etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf

ls: /etc/my.cnf: No such file or directory

ls: /etc/mysql/my.cnf: No such file or directory

ls: /usr/etc/my.cnf: No such file or directory

ls: /root/.my.cnf: No such file or directory

[root@DB-Server ~]# locate my.cnf

/usr/my.cnf

[root@DB-Server ~]# find / -name "my.cnf"

/usr/my.cnf

a30e7ab7747fc6c4afc7bcab992234a1.png

我们知道MySQL启动的时候,会先去读取参数文件my.cnf中的参数去初始化,默认情况下,MySQL会按一定的顺序来读取参数文件,这个顺序为/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf但是,在这个MySQL版本中my.cnf 参数文件位于/usr/my.cnf下,Why? 一头懵逼! 然后我测试了一下其它版本,例如mysql-community-server-5.7.18,确实都是位于指定的目录,如下所示

[root@gettestlnx02 ~]# locate my.cnf

/etc/my.cnf

/etc/my.cnf.d

[root@gettestlnx02 ~]# strace mysql ";" 2>&1 | grep my.cnf

stat64("/etc/my.cnf", {st_mode=S_IFREG|0644, st_size=979, ...}) = 0

open("/etc/my.cnf", O_RDONLY|O_LARGEFILE) = 3

stat64("/etc/mysql/my.cnf", 0xffc0f4a0) = -1 ENOENT (No such file or directory)

stat64("/usr/etc/my.cnf", 0xffc0f4a0)   = -1 ENOENT (No such file or directory)

stat64("/root/.my.cnf", 0xffc0f4a0)     = -1 ENOENT (No such file or directory)

[root@gettestlnx02 ~]#  rpm -qf  /etc/my.cnf

mysql-community-server-5.7.18-1.el6.i686

[root@gettestlnx02 ~]#

ef9eca9886a8b1337a04dd7aeb50d216.png

后面搜索了一下,发现这居然是一个bug来着。具体参考下面链接

With recent MySQL 5.6 versions, the RPM installation generate a non-standard /usr/my.cnf file overriding the sql_mode set in /etc/my.cnf as per:https://bugs.mysql.com/bug.php?id=71600

This occurs during upcp when minor MySQL updates are installed and breaks some sites due to "STRICT_TRANS_TABLES".

Please add the flag --keep-my-cnf when executing mysql_install_db or otherwise remove the /usr/my.cnf file after MySQL upgrade during upcp to remove this unexpected change.

参考资料:

https://features.cpanel.net/topic/disable-creation-of-usrmy-cnf-when-mysql-is-installed

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值