7

MySQL配置文件加载顺序

 2 years ago
source link: https://viencoding.com/article/9
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

通常情况下是以下顺序

  1. /etc/my.cnf
  2. /etc/mysql/my.cnf
  3. SYSCONFDIR/my.cnf basedir/my.cnf
  4. $MYSQL_HOME/my.cnf datadir/my.cnf
  5. 加启动指定参数 -defaults-file=#, 只读取指定的文件(不再读取其他配置文件) -defaults-extra-file=#,从其他优先级更高的配置文件中读取全局配置后,再读取指定的配置文件。
  6. ~/my.cnf

同时配置同一属性的时候,后面的配置会覆盖前面的配置,除非使用 -defaults-file 指定文件

查看读取顺序的方法

Terminal下输入: mysqld --verbose --help | grep -A 1 'Default options'

观察如下信息:


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

> 如果PATH中没有MySQL home的话,会提示命令找不到。去你安装mysql的目录中进入bin目录,然后再执行
viencoding.com版权所有,允许转载,但转载请注明出处和原文链接: https://viencoding.com/article/9
欢迎小伙伴们在下方评论区留言 ~ O(∩_∩)O
文章对我有帮助, 点此请博主吃包辣条 ~ O(∩_∩)O

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK