Home  >  Article  >  Database  >  How to use mysql global lock

How to use mysql global lock

PHPz
PHPzforward
2023-05-26 12:52:061373browse

1. Global lock locks the entire database. After locking, the entire instance will be in a read-only state.

2. Subsequent MDL writing sentences, DDL sentences, and updated transaction commit sentences will be blocked. Its typical usage scenario is to make a logical backup of the entire database.

Lock all tables to obtain a consistent view and ensure data integrity.

Example

# 全局锁,简称FTWRL
FLUSH TABLES WITH READ LOCK;
 
# 解锁命令
UNLOCK TABLES;

The above is the detailed content of How to use mysql global lock. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete