Experience-mysql configuration file reading order problem!

Source: Internet
Author: User

Reason:

The MySQL command can be used to connect to the server, but where the data is usually stored, the parameters are set, which requires knowing which configuration file is used by MySQL. (usually my.cnf this configuration problem)

Therefore, it is necessary to clear the MY.CNF loading order.


Default load Order:

/ETC/MY.CNF global Options
/ETC/MYSQL/MY.CNF
SYSCONFDIR /my.cnf global Options
$MYSQL _home/my.cnf server-specific options
defaults-file|extra-file the file specified with --defaults-extra-file=path ...  
~/my.cnf User-specific Options

Reading order

1,/ETC/MY.CNF

The general configuration file will be here, of course, when MySQL starts the service, it will read the configuration file by default. (multi-instance MySQL to be cautious!) )

2./etc/mysql/my.cnf

一般系统etc并没有mysql这个目录,如果需要自己创建。

3, SYSCONFDIR /my.cnf

basedir/my.cnf

4, $MYSQL _home/my.cnf

datadir/my.cnf

5, plus start the specified parameters

-defaults-file=#, read only the specified file (no longer read other configuration files)

-defaults-extra-file=#, read the global configuration from other higher-priority profiles before reading the specified configuration file.

6、~/my.cnf

Tips:

1, assume that 4 configuration files are present, also use the--defaults-extra-file specified parameter file, if there is a "parameter variable" in the 5 configuration file appears, then the parameter value in the configuration file will overwrite the parameter variable value in the previous configuration file, This means that the value set in ~/.MY.CNF is used.

2、/usr/local/mysqltwo/bin/mysqld--verbose--help |grep-a 1 ' Default options '

Without excluding the version of the problem, some paths will be different. For example, some paths are my.cnf under/usr


The specific reading order can be based on your own version and official manuals!


This article from the "[email protected]" blog, reproduced please contact the author!

Experience-mysql configuration file reading order problem!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.