今天在折腾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. CentOS5/6/7系统下搭建安装Amabari大数据集群时出现SSLError: Failed to connect. Please check openssl library versions.错误的解决办法(图文详解)

    不多说,直接上干货! ========================== Creating target directory... ========================== Comman ...

  2. jvm详情——4、分代垃圾回收详述

    虚拟机中的共划分为三个代: 年轻代(Young Generation) 年老点(Old Generation) 持久代(Permanent Generation) 其中持久代主要存放的是Java类的类 ...

  3. 2014-2015 ACM-ICPC, Asia Xian Regional Contest(部分题解)

    摘要 本文主要给出了2014-2015 ACM-ICPC, Asia Xian Regional Contest的部分题解,说明了每题的题意.解题思路和代码实现,意即熟悉区域赛比赛题型. Built ...

  4. [转]MySQL-死锁查询

    本文转自:https://blog.csdn.net/qq105319914/article/details/50562783 1.查询是否锁表 show OPEN TABLES where In_u ...

  5. vim撤销undo与反撤销redo

    普通模式下  u 撤销 ctrl + r 反撤销

  6. WPF 自定义Command

    无参Command: internal class DelegateCommand : ICommand { private readonly Action _execute; private rea ...

  7. How std::cout works [duplicate]

    Question: I accidentally found: cout << cout; The output is some address. What does this addre ...

  8. php环境安装

    Windows安装 下载php压缩包, http://php.net/downloads.php, 一定要下载Windows版本的呦 将压缩包解压到指定目录下: 创建配置文件, 其中有两个配置文件在根 ...

  9. MVC模式-----struts2框架

    MVC模式-----struts2框架 一.struts MVC模式 1.概述 MVC是模型(model)---视图model(view)---控制器(control)的缩写,是一种用于将逻辑.数据和 ...

  10. js 取数组中某个对象的集合

    var arr = [ {a:1,b:2,c:3}, {a:4,b:5,c:6}, {a:7,b:8,c:9} ]; arr1=[]; arr.forEach(function(v){ arr1.pu ...