There are two types of locking:
- Internal locking: MySQL performs internal locking within the server itself to manage contention for table contents by multiple sessions
- External locking: MySQL gives the option to client sessions to acquire a table lock explicitly for preventing other sessions from accessing the table
Internal locking: There are mainly two types of locks:
- Row-level locks: The locking is granular to the level of rows. Only the rows that are accessed are locked. This allows simultaneous write access by multiple sessions, making them suitable for multi-user, highly concurrent, and OLTP applications. Only InnoDB supports row-level locks.
- Table-level locks: MySQL uses table-level locking for MyISAM, MEMORY, and MERGE ...