MariaDB [test]> lock table super1 read;Query OK, 0 rows affected (0.00 sec)MariaDB [test]> select * from super1;+----+| id |+----+| 1 || 2 || 3 || 5 || 6 || 7 |+----+6 rows in set (0.00 sec)MariaDB [test]> insert into super1 VALUE(10);ERROR 1099 (HY000): Table 'super1' was locked with a READ lock and can't be updted
other session can SELECT too
MariaDB [test]> unlock tables;Query OK, 0 rows affected (0.00 sec)MariaDB [test]> lock table super1 write;Query OK, 0 rows affected (0.00 sec)
other session can't SELECT
MariaDB [test]> insert into super1 VALUE(10);Query OK, 1 row affected (0.00 sec)MariaDB [test]> insert into super1 VALUE(11);Query OK, 1 row affected (0.00 sec)MariaDB [test]> unlock tables;Query OK, 0 rows affected (0.00 sec)