Considerations for disabling MySQL

Source: Internet
Author: User
There are many ways to close mysql, but not everyone knows how to safely and easily close mysql. the following link is used to summarize several mysql closing methods and precautions: 1. initiate shutdown and send the SIGTERM signal. 2. Create a New shutdownthread if necessary. 3. MySQLServer no longer responds.

There are many ways to close mysql, but not everyone knows how to safely and easily close mysql. the following link is used to summarize several mysql closing methods and precautions: 1. initiate shutdown and send the SIGTERM signal. 2. Create a New shutdownthread if necessary. 3. MySQLServer no longer responds.

Zookeeper

There are many ways to close mysql, but it is not everyone knows how to safely and easily close mysql. Below we will link up the north to summarize several mysql shutdown methods and precautions.

Closing Process:

1. initiate shutdown and send a SIGTERM Signal

2. Create a shutdown thread if necessary)

3. MySQL Server no longer responds to new connection requests

4. Close the current connection and transaction gradually

5. the MySQL Server process closes all threads and all storage engines;

6. MySQL Server process exited

About KILL commands

From 5.0, KILL supports specifying CONNECTION and QUERY options:

Like the original kill connection, KILL the transaction rollback, close the thread CONNECTION, and release related resources;

Kill query only stops the operations currently submitted by the thread, and the other operations remain unchanged;

After the KILL operation is submitted, a special kill flag is set on this thread. It usually takes some time to actually close the thread, because the kill flag is only checked under specific circumstances:

1. When a SELECT query is executed, in the order by or group by loop, the kill flag is checked after reading some row record blocks each time. If yes, the statement is terminated;

2. When alter table is executed, the system checks the kill flag after reading some row record blocks from the original TABLE. If the block is found to exist, the statement terminates and deletes the temporary TABLE;

3. When UPDATE and DELETE are executed, the kill flag is checked every time some row record blocks are read and updated or deleted. If yes, the statement will terminate and roll back the transaction, if an operation is performed on a non-transaction table, the changed data is not rolled back;

4. The GET_LOCK () function returns NULL;

Suggestions for safely disabling MySQL

To safely disable the mysqld service process, follow these steps:

0. Use an account with the highest permissions such as SUPER and ALL to connect to MySQL. It is best to use a unix socket to connect;

1. In versions 5.0 and later, set innodb_fast_shutdown = 1 to allow quick InnoDB Shutdown (full purge and insert buffer merge are not performed). To upgrade or downgrade MySQL, do not set it;

2. Set innodb_max_dirty_pages_pct to 0, so that InnoDB can refresh all dirty pages to the disk;

3. Set max_connections and max_user_connections to 1. In addition to the current connection, new connections cannot be created;

4. Shut down all inactive threads, that is, the thread ID in Sleep state and with Time greater than 1;

Reference: http://bbs.landingbj.com/t-0-247144-1.html

Zookeeper

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.