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)
introduce Usually a background server program mus...
Recommended Docker learning materials: https://ww...
Table of contents 01. Listener watch (1) Function...
Controversy over nofollow There was a dispute bet...
Import the data exported from the Oracle database...
I just joined a new company recently. After getti...
Are you still looking for a way to enable Hyper-v...
1. View openjdk rpm -qa|grep jdk 2. Delete openjd...
Table of contents Introduction Instructions Actua...
The first time I wrote a MySQL FUNCTION, I kept g...
This article records the installation and configu...
DPlayer.js video player plug-in is easy to use Ma...
OBS studio is cool, but JavaScript is cooler. Now...
Effect There are currently 2 projects (project1, ...
Table of contents 1. Prototype mode Example 1 Exa...