The order in which MySQL reads my.cnf1. mysql.server startup methodbasedir=/opt/mysql/mysql3315 datadir=/opt/mysql/mysql3315/data To search, -e will be brought in for parsing when parsing the parameter file /opt/mysql/mysql3315/bin/my_print_defaults -e /opt/mysql/mysql3315/my.cnf mysqld server mysql_server mysql.server That is, --defaults-extra-file, the obtained directory includes basedir, datadir, and pid-file, but the pid-file parameter may not exist Use as follows if test -z "$mysqld_pid_file_path" then mysqld_pid_file_path=$datadir/`hostname`.pid else case "$mysqld_pid_file_path" in /* ) ;; * )mysqld_pid_file_path="$datadir/$mysqld_pid_file_path" ;; esac fi Convert the location and file name. The final parameters are as follows: /opt/mysql/mysql3315/bin/mysqld_safe --datadir=/opt/mysql/mysql3315/data/ --pid-file=/opt/mysql/mysql3315/data//mgr4.pid 2. mysqld_safe startup method
/opt/mysql/mysql3315/bin/my_print_defaults mysqld server mysql_server mysql.server Note: -e is not set here because the MYSQL_HOME directory will automatically parse the parameter files below it. The parsing location is shown at the end.
nohup /opt/mysql/mysql3315/bin/mysqld --basedir=/opt/mysql/mysql3315 --datadir=/opt/mysql/mysql3315/data --plugin-dir=/opt/mysql/mysql3315/lib/plugin --user=mysql --log-error=/opt/mysql/mysql3315/logs/mysql3315.err --pid-file=/opt/mysql/mysql3315/data//mgr4.pid --socket=/opt/mysql/mysql3315/data/mysql3315.sock --port=3315 Note: If open_files_limits is set, open_file_limits will be used here to overwrite the configuration in the parameter file used by mysqld
After startup, the following loop will be performed. The eval command will be used to block the call to mysqld. If the process exits, it will return and perform a loop judgment. Finally, it will determine whether the pid exists and whether it is a normal shutdown of mysqld. The judgment method is kill -0 pid to determine whether the mysqld process exists. If it doesn't exist, pull it up. while true do echo 1 start_time=`date +%M%S` eval_log_error "$cmd"
if [ -n "$mysqld_ld_library_path" ]; then new_text="$mysqld_ld_library_path" [ -n "$LD_LIBRARY_PATH" ] && new_text="$new_text:$LD_LIBRARY_PATH" text="${text}LD_LIBRARY_PATH="`shell_quote_string "$new_text"`' ' fi
``` /home/work/ssd1/mysql/install/bin/mysqld_safe --defaults-file=/home/work/ssd1/mysql/etc/3307/my.cnf --socket=/home/work/ssd1/mysql/sock/3307/mysql.sock --datadir=/home/work/ssd1/mysql/data/3307 --user=mysql & If you start my_print_defaults like this, it will bring --defaults-file /opt/mysql/mysql3320/install/bin/my_print_defaults --defaults-file=/home/work/ssd1/mysql/etc/3307/my.cnf --loose-verbose mysqld server 3. About the order in which mysqld and my_print_defaults read my.cnf In fact, this function init_default_directories function <—defaults-file is read first, and only reads this configuration file, and is the first option>
After parsing is complete, all parameters are listed. If there are multiple parameters with the same name, the last one will take effect. This is the end of this article about the details of the order in which MySQL reads my.cnf. For more information about the order in which MySQL reads my.cnf, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Add unlimited fonts to your website with Google Web Fonts
>>: CSS tips for controlling animation playback and pause (very practical)
Nowadays, application development is basically se...
Error screenshot Can't find where the excepti...
This article takes the connection error ECONNREFU...
1. Unzip the downloaded MySQL compressed package ...
Preface Reduce is one of the new conventional arr...
When the front-end requests the interface, it is ...
Achieve results Implementation Code html <div ...
Table of contents 1. The role of array: 2. Defini...
Add the jvm.options file to the elasticsearch con...
Table of contents Overview Precautions 1. Usage 2...
Table of contents Introduction Log classification...
1. Problem Description When starting MYSQL, a pro...
Flex(彈性布局) in CSS can flexibly control the layout...
<br />Every family has its own problems, and...
Basics A transaction is an atomic operation on a ...