Mysql basics: Detailed description of mysqld_safe startup Execution Process

Source: Internet
Author: User

The basic process of mysqld_safe script execution:
1. Search for basedir and ledir.
2. Search for datadir and my. cnf.
3. Check my. cnf. For details about the options, see the annotations in the attachment.
4. parse the groups [mysqld] and [mysqld_safe] In my. cnf and merge them with the commands entered in the terminal.
5. Call the parse_arguments function to parse all parameters passed by the user ($ @).
6. For details about how to judge and handle system logs and error logs, refer to the comments in the attachment and assign values to the err-log parameter.
7. Process and assign values to options -- user, -- pid-file, -- socket, and -- port to ensure that these parameters will also have a value if they are not provided at startup.
8. Start mysqld.
A) The system checks whether A process number exists at startup. If yes, it records "a mysqld process already exists" in the error log and exits.
B) Delete the process file if it does not exist. If it cannot be deleted, record "Fatal error: Can't remove the pid file" in the error log and exit.
9. Check the table at startup. If the checklist is enabled, setting key_buffer and sort_buffer increases the speed and reduces disk space usage. You can also use the myisam-recover option to restore an error myisam table.
10. If you do not provide any parameters at startup, some specific parameters will be used for startup. For specific parameters, see the attachment notes.
11. If the server is shut down abnormally, it will be restarted.

The last three steps are summarized.
Check Environment
Check Configuration Options
Processing after startup and startup

Conclusion: the advantages of mysqld_safe startup are as follows.
1. mysqld_safe adds some security features, such as restarting the server when an error occurs and writing the running time information to the error log file.
2. If some options are exclusive to mysqld_safe during startup, you can specify them on the terminal. If the options are specified in the configuration file, they must be placed in the [mysqld_safe] group. Other groups cannot be correctly parsed.
3. When mysqld_safe is enabled, you can specify the Kernel File size ulimit-c $ core_file_size and the number of opened files ulimit-n $ size.
4. the MySQL program first checks the environment variables, then the configuration file, and finally the terminal options, indicating that the options specified by the terminal have the highest priority.

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.