O'Reilly logo

MySQL 8 Cookbook by Karthik Appigatla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

The syntax is as follows:

mysql> LOCK TABLES table_name [READ | WRITE]

To unlock the tables, use:

mysql> UNLOCK TABLES;

To lock all tables across all databases, execute the following statement. It is used when taking a consistent snapshot of the database. It freezes all writes to the database:

mysql> FLUSH TABLES WITH READ LOCK;

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required