1. Overview and classification of locks
2. Introduction to global locks
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!
mysqldump --single-transaction -uroot -p123456 itcast >itcast.sql