MySQL interview questions-MySQL my.cnf configuration file loading order

The MySQL service needs to read the configuration file to start. If there are multiple my.cnf configuration files, what is the order of loading?

Linux

  • /etc/my.cnf
  • /etc/mysql/my.cnf
  • /usr/local/mysql/etc/my.cnf
  • ~/.my.cnf
  • My.cnf under other custom paths, for example: /data/mysql/yejr_3306/my.cnf

Whether it is the mysqld server program or the mysql client program, you can use the following two parameters to specify the path of the configuration file to be read:
-defaults-file=#, only read the specified file (no longer read other Configuration file)
-defaults-extra-file=#, after reading the global configuration from other configuration files with higher priority, then read the specified configuration file (some options can override the setting value of the global configuration)

Windows

  • C: \ Windows \ my.ini
  • C:\Windows\my.cnf
  • C: \ my.ini
  • C:\my.cnf
  • C:\Program Files\MySQL\MySQL Server XX\my.ini
  • C:\Program Files\MySQL\MySQL Server XX\my.cnf

Guess you like

Origin blog.csdn.net/XY0918ZWQ/article/details/113759960