Introduction to locks in MySQL - global locks

1. Overview and classification of locks

insert image description here
insert image description here

2. Introduction to global locks

insert image description here
insert image description here
Add a global lock to the database:

flush tables with read lock;

Data backup:
mysqldump backup command root user name 1234 password itcast database name itcast.sql backup file name

mysqldump -uroot -p1234 itcast >itcast.sql;

Database global lock unlock:

unlock tables;

Before unlocking, the data in the database can only be read but not written!
insert image description here
insert image description here
insert image description here

mysqldump --single-transaction -uroot -p123456 itcast >itcast.sql

insert image description here

Guess you like

Origin blog.csdn.net/weixin_44860226/article/details/131947181