今天在折腾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

我们知道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 ~]# 

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

https://bugs.mysql.com/bug.php?id=68318

https://bugs.mysql.com/bug.php?id=71600

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

https://bugs.mysql.com/bug.php?id=71600

MySQL 5.6.20-enterprise-commercial的参数文件位置问题的更多相关文章

  1. Oracle12c多租户CDB 与 PDB 参数文件位置探讨、查询 CDB 与 PDB 不同值的参数

    一. Oracle12c多租户CDB 与 PDB 参数文件位置CDB的参数文件依然使用12c以前的SPIFLE,pdb的参数文件不会出现在SPFILE中,而是直接从CDB中继承,如果PDB中有priv ...

  2. mysql 5.7.20 动态sql 传入参数

    drop procedure test; delimiter ;; CREATE procedure test() -- 取动态sql的值 -- 目前只测试出,在 where 后面, 可以用 ?,类似 ...

  3. MySQL参数文件位置

    对于linux/unix: mysql --help|grep my.cnf   /etc/my.cnf, /etc/mysql/my.cnf, /usr/local/etc/my.cnf, ~/.m ...

  4. 【查阅】mysql配置文件/参数文件重要参数笔录(my.cnf)

    持续更新,积累自己对参数的理解 [1]my.cnf参数 [client]port = 3306socket = /mysql/data/3306/mysql.sockdefault-character ...

  5. MYSQL数据库的参数文件

    参数文件:告诉MySQL实例启动时在哪里可以找到数据库文件,并且指定某些初始化参数,这些参数定义了某种内存结构的大小等设置,还会介绍各种参数的类型. 参数文件 当MySQL实例启动时,MySQL会先去 ...

  6. oracle参数文件spfile和pfile

    一.参数文件说明 PFILE(Initialiazation Parameter Files)初始化参数文件,是文本文件,可直使用文本编辑器查看.如果数据库使用的是初始化参数文件PFILE,要想永久修 ...

  7. oracle参数文件与启动过程

    oracle随系统启动而启动 cs65-64桌面版orcle-11.2.0.4 启动监听器,后台进程,OEM. 注意: 如果只做一和三,只能启动后台进程,监听器不启动,如果只做二和三,只能启动监听器, ...

  8. MySQL服务读取参数文件my.cnf的规律研究探索

    在MySQL中,它是按什么顺序或规律去读取my.cnf配置文件的呢?其实只要你花一点功夫,实验测试一下就能弄清楚,下面的实验环境为5.7.21 MySQL Community Server.其它版本如 ...

  9. Ubuntu下面MySQL的参数文件my.cnf浅析

    前几天刚接手一个MySQL数据,操作系统为Ubuntu 16.04.5 LTS,  数据库版本为5.7.23-0ubuntu0.16.04.1(APT方式安装的MySQL).这个操作系统下的MySQL ...

随机推荐

  1. Linux文件系统及文件属性

    一.Linux文件系统 1.穿件文件系统 Linux中当磁盘格式化创建文件系统时,会创建一定数量的节点索引Inode以及一定数量的块block,其中inode具有存储文件属性以及指向文件实体block ...

  2. leetcode — jump-game

    /** * Source : https://oj.leetcode.com/problems/jump-game/ * * Created by lverpeng on 2017/7/17. * * ...

  3. Mycat - 高可用与负载均衡实现,满满的干货!

    前言 开心一刻 和朋友去吃小龙虾,隔壁桌一个小女孩问妈妈:"妈妈,小龙虾回不了家,它妈妈会不会着急?" 她妈妈愣住了,我扒虾的手停下了,这么善良的问题,怎么下得了口.这是老板急忙过 ...

  4. Go Web:URLs

    URL也是一个结构体: type URL struct { Scheme string Opaque string // encoded opaque data User *Userinfo // u ...

  5. LeetCode-63. 不同路径 II

    最近英文版的访问特别慢,转战中文吧 和上一题一样,递归会超时 //63 不同路径2,递归解法 int uniquePaths2(vector<vector<int>>& ...

  6. [转]Build An Image Manager With NativeScript, Node.js, And The Minio Object Storage Cloud

    本文转自:https://www.thepolyglotdeveloper.com/2017/04/build-image-manager-nativescript-node-js-minio-obj ...

  7. [转]windows BLE编程 net winform 连接蓝牙4.0

    本文转自:https://www.cnblogs.com/webtojs/p/9675956.html winform 程序调用Windows.Devices.Bluetoot API 实现windo ...

  8. [android] 开启新的activity获取他的返回值

    应用场景:打开一个新的activity,在这个activity上获取数据,返回给打开它的界面 短信发送时,可以直接选择系统联系人 界面布局是一个线性布局,里面右侧选择联系人在EditText的右上,因 ...

  9. 4.6 explain 之 rows

    一.说明 根据表统计信息及索引选用情况,大致估算出找到所需的记录所需读取的行数. 二.示例 关注我的公众号,精彩内容不能错过

  10. json字符串和json对象的相互转化

    开发经常要用到json字符串和json对象的相互转化,这里总结常用的两个函数.JSON.parse('字符串'),JSON.stringify('json对象') <script type=&q ...