The difference between FLUSH TABLES with READ Lock and set global Read_only=1

Source: Internet
Author: User
The set global read_only is a global level and can be written by the root user after 1, and other users cannot write FLUSH tables with read lock is table-level (using unlock tables to unlock) and cannot be written by all users after execution. But after flush tables, the lock fails, and the set global READ_ONLY does not fail
Set global read_only=true or set global Read_only=on or set global Read_only=1
Set global Read_only=false or set global Read_only=off or set global read_only=0

1:select @ @read_only \g
->@ @read_only: 0
1:create TABLE IF not EXISTS bla (id BIGINT (), PRIMARY KEY (id)); 
 1:lock TABLE bla READ;
2:set Global read_only=0;
->will block until the lock from Connection 1 is released.

1:unlock TABLES;
2:set Global Read_only=1;
1:select @ @read_only \g
->@ @read_only: 1
1:lock TABLE bla read;
2:set Global Read_only=1;
->will block until the lock from Connection 1 is released.

1:unlock TABLES;
1:select @ @read_only \g
->@ @read_only: 1
1:lock TABLE bla read;
2:set Global read_only=0;
->will block until the lock from Connection 1 is released.

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.