今天在折腾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. DotNetCore深入了解之一Startup类

    一个典型的ASP.NET Core应用程序会包含Program与Startup两个文件.Program类中有应用程序的入口方法Main,其中的处理逻辑通常是创建一个WebHostBuilder,再生成 ...

  2. springboot~让我习惯了TDD的开发模式

    TDD是什么 TDD就是测试驱动开发,以测试用例为主导,去开发项目,业务代码该怎么写还是怎么写,在实现UI之前,可以先实现Test用例,通过test来实现对业务场景的模拟,最终让你的代码更稳定. 大叔 ...

  3. [ASP.NET MVC]笔记(四) UnobtruSive AJAX和客户端验证

    UnobtruSive AJAX和客户端验证 ASP.NET MVC 已经默认开启非侵入试js和客户端验证,在web.config可以看到如下配置: <configuration> < ...

  4. leetcode — two-sum

    package org.lep.leetcode.twosum; import java.util.Arrays; import java.util.HashMap; import java.util ...

  5. 阿里AI设计师一秒出图,小撒连连惊呼,真相是...

    近期,央视<机智过人>的舞台上来了位“三超设计师”——设计能力超强:出图能力超快:抗压能力超强,成功迷惑嘉宾和现场观众,更让撒贝宁出错三连. 节目一开场,这位“设计师”就为现场嘉宾:主持人 ...

  6. Http系列目录

    1.Http简史 2.Http协议基本术语 3.Http1.1 4.Http2.0

  7. Python下用Scrapy和MongoDB构建爬虫系统(1)

    本文由 伯乐在线 - 木羊 翻译,xianhu 校稿.未经许可,禁止转载!英文出处:realpython.com.欢迎加入翻译小组. 这篇文章将根据真实的兼职需求编写一个爬虫,用户想要一个Python ...

  8. 翻译:select into outfile(已提交到MariaDB官方手册)

    本文为mariadb官方手册:SELECT INTO OUTFILE的译文. 原文:https://mariadb.com/kb/en/select-into-outfile/ 我提交到MariaDB ...

  9. python安装第三方库的最简单方式

    一.准备工作 (只做一次准备工作,以后都会很方便) 1. 安装pip (1)下载pip到D:\download pip下载地址:https://pypi.python.org/pypi/pip#dow ...

  10. [转]使用jenkins实现持续集成

    本文转自:https://www.cnblogs.com/zishengY/p/7170656.html 一.jenkins 介绍 它是一个自动化的周期性的集成测试过程,从检出代码.编译构建.运行测试 ...