Mysql Foundation: Mysqld_safe Start execution Process detailed _mysql

Source: Internet
Author: User

The basic process of Mysqld_safe script execution:
1, find Basedir and Ledir.
2, find DataDir and my.cnf.
3, to MY.CNF do some checks, specific check which options please see the comments in the attachment.
4, parse the group [mysqld] and [Mysqld_safe] in my.cnf and merge with the commands entered in the terminal.
5, call the Parse_arguments function to resolve all the parameters passed by the user ($@).
6, the System log and error log judgment and the corresponding processing can refer to the appendix of the comments, and options--err-log parameters of the assignment.
7, the choice of--user,--pid-file,--socket and--port processing and assigning value, to ensure that when the startup if not given these parameters it will also have a value.
8, start mysqld.
A will determine if a process number exists at startup, and if so, record "A mysqld process already exists" in the error log and exit.
(b) If it does not exist, delete the process file, if it is not deleted, then in the error log record "Fatal Error:can ' t remove the PID file" and exit.
9. Check the table at startup. Setting Key_buffer and Sort_buffer when checking the table at startup can increase speed and reduce disk space usage. You can also use the Myisam-recover option to recover an error MyISAM table.
10, if you do not have any parameters to start, then it will choose some specific parameters to start, the specific parameters please see the attachment note.
11, if the server shuts down unexpectedly, then will restart.

Finally, take three steps to sum up
Check the Environment
Check configuration options
Handling after startup and startup

Summary: Choose the benefits of Mysqld_safe startup. The
1, Mysqld_safe adds some security features, such as restarting the server when an error occurs and writing Run-time information to the error log file.
2, if any of the options are specific to Mysqld_safe startup, you can specify that if you specify in the configuration file that you want to put in the [Mysqld_safe] group, the other groups cannot be parsed correctly. The
3, Mysqld_safe boot can specify the kernel file size ulimit-c $core _file_size and the number of open files Ulimit-n $size.
4, the MySQL program first check the environment variables, and then check the configuration file, and finally check the terminal options, indicating that the terminal specified options the highest priority.

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.