MySQL read configuration file order, start mode, startup principle

Source: Internet
Author: User


First, MySQL read the configuration file order

Reading order:/etc/my.cnf >/etc/mysql/my.cnf >/usr/etc/my.cnf > ~/.MY.CNF

Command verification:
[[email protected] ~]# MySQL--verbose--help | grep my.cnf
Order of preference, MY.CNF, $MYSQL _tcp_port,
/ETC/MY.CNF/ETC/MYSQL/MY.CNF/USR/ETC/MY.CNF ~/.my.cnf

Second, MySQL startup mode

MySQL is typically started in three different ways: Mysqld, Mysqld_safe, Mysqld_multi (mainly for multi-instance booting)

Three ways of relationship:
First, when we started with service mysqld start or/etc/init.d/mysqld start, we actually used the Mysql.server script, which is called by default Mysqld_ Safe to start mysqld, so usually when we start MySQL, we look at the process and see that there are two processes, mysqld and Mysqld_safe. Both of these are usually single-instance start-up, and of course you can use MYSQLD to start multiple instances. And Mysqld_multi is used to start multiple instances, but also by first calling Mysqld_safe and mysqld to start MySQL.

Third, the MySQL startup principle

The default MySQL service launcher is the Mysql.server,mysql.server program that uses two programs and a function, namely My_print_defaults, Myslqd_safe, and Parse_server_ Arguments

1, My_print_defaults: Read the my.cnf configuration file, output parameters passed to parse_server_arguments, the program read only the parameters in [mysqld] in my.cnf.

2, Parse_server_arguments: This function handles my_print_defaults passed the parameters assigned to--basedir 、--datadir 、--pid-file 、-- Server-startup-timeout

3. The Myslqd_safe:mysqld_safe program calls the MYSQLD program to start the MySQL service, [Mysqld_safe] overrides the parameters in the Mysqld section

4, Mysqld_multi will read [MYSQLD_MUTI],[MYSQLDN] in the configuration file under the parameters, N needs an integer, it is recommended that the port number, the configuration of the section overrides the configuration in the [Mysqld] section

5, when the mysqld process hangs, the mysqld_safe process will monitor and re-start the mysqld.

MySQL read configuration file order, start mode, startup principle

Related Article

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.