Parameters for starting a process
The MySQL server maintains many system variables that indicate how it is configured. Each system variable has a default value. System variables can is set at server startup using options on the command line or in an option file. Most of them can bechanged dynamically while the server was running by means of the SET Statement,which enables your to Modi FY operation of the server without has to stop and restart it. You can refer to the system variable values in expressions.
When starting MySQL, we can manually specify the relevant parameters at the back of the command:
# mysqld_safe--basedir=/usr/local/mysql--datadir=/mydata/data--user=mysql--pid-file=/var/lib/mysql/mysql.pid-- Socket=/var/lib/mysql/mysql.sock--port=3306
Here is our default parameter value, and we can see the specific values of MySQL's default parameters by the following command:
(1) To see the values of a Serverwill use based in its compiled-in defaults and any option files, it reads,use this C Ommand:
# mysqld--verbose--help
(2) To see the values of a Serverwill use based on their compiled-in defaults, ignoring the settings in any optionfiles, US E This command:
# mysqld--no-defaults--verbose--help
If each start is manually specified parameter is troublesome, we can set the relevant parameters to the parameter file, at MySQL startup will read these files, the location of the parameter file:
On Unix, Linux and Mac OS x., MySQL programsread startup options from the following files, in the specified order (topitems is used first).
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/40/03/wKioL1PN3-6ScVkDAAD1Wg0zy8E567.jpg "title=" 9.png " alt= "Wkiol1pn3-6scvkdaad1wg0zy8e567.jpg"/>
Note the order of the parameter files in the table above, and MySQL takes precedence over the above parameter files in order from the top down.
~ represents the current user's home directory (the value of $HOME).
sysconfdir representsthe directory specified with the Sysconfdir option to CMake when MySQL wasbuilt. By default, this is the ETC directory located under the Compiled-ininstallation directory.
mysql_home is a environment variable containing the path to the directory in which Theserver-specific my.cnf fil E resides. If Mysql_home is isn't set and you start theserver using the Mysqld_safe program, Mysqld_safe attempts to set Mysql_home ASF Ollows:
(1) Let BASEDIR and DataDir representthe path names of the MySQL base directory and data directory, respectively.
(2) If There is a my.cnf the file in DataDir and not in the BASEDIR, Mysqld_safe sets Mysql_home to DataDir.
(3) Otherwise, if Mysql_home is not setand there are no my.cnf file in DataDir, Mysqld_safe sets Mysql_home to BASEDIR.
In MySQL 5.5,use of DataDir as the location for MY.CNF is deprecated.
-in MySQL 5.5, the my.cnf file has not been placed in the DataDir directory .
Typically, DataDir is/usr/local/mysql/data for a binary installation or/usr/local/var for a source installation. Note that this is the data directory location of the wasspecified at configuration time and not the one specified with the--da Tadir Optionwhen mysqld starts. Use of--datadir at runtime have no effect on where theserver looks for option files, because it looks for them before proc Essing anyoptions.
Assuming that 4 configuration files are present, and the parameter file is specified with--defaults-extra-file, if a parameter variable is present in all 5 configuration files, then the parameter value in the subsequent configuration file overrides the parameter variable value in the previous configuration file. This means that the value set in ~/.MY.CNF is used.
That is, when more than one configuration file exists, MySQL will take the parameters in the last configuration. The more you read it, the higher the priority of the action, which is the general rule for Linux.
NOTE * * *
If you use the./bin/mysqld_safe daemon to start the MySQL database, the absolute path > parameters of the --defaults-file=< profile are used, and only the configuration file specified by this parameter is used.
This article is from the "Share Your Knowledge" blog, so be sure to keep this source http://skypegnu1.blog.51cto.com/8991766/1441266
MySQL configuration file read order