MySQL Lock and Unlock Table

The lock is a mechanism in MySQL to restrict unauthorized access to a personal table. MYSQL allows us to incorporate table locks and are of many types for various types of locks. MYSQL also prevents unauthorized modifications to the table when in a locked state.

MySQL Lock Table

  • Tables can be locked with a specific syntax based on the lock statement and the lock type applied.
LOCK TABLES TableName [READ | WRITE];  
  • We can specify the lock type whether we want to read lock or write lock.
  • Multiple tables can also be locked with a simple syntax in place.
LOCK TABLES tableName1 [READ | WRITE],   
            tableName2 [READ | WRITE],...... ;
  • Using this, multiple tables can also be locked.

MySQL Unlock Table

  • Using a simple syntax, we can unlock tables at ease in MySQL.
UNLOCK TABLES;
Fri, 07/15/2022 - 09:14
Ashwin possesses over five years of experience in the Quality Assurance industry and is currently serving as a Technical Lead at iVagus. His expertise encompasses a broad range of technologies, including Cypress, Rest Assured, Selenium, Cucumber, JavaScript and TypeScript.
Tags

Comments