root@db 15:32: [aaaa]> lock table aaa write , aaa as t1 read; Query OK, 0 rows affected (0.00 sec) root@db 15:32root@db 04:01: [aaaa]> select * from aaa; +----+------+-------------+ | id | name | telephone | +----+------+-------------+ | 1 | e | 11111111111 | | 2 | e | 22222222222 | | 3 | c | 33333333333 | | 4 | d | 44444444 | +----+------+-------------+ 4 rows in set (0.00 sec)
root@db 04:01: [aaaa]> select * from aaa as t1; +----+------+-------------+ | id | name | telephone | +----+------+-------------+ | 1 | e | 11111111111 | | 2 | e | 22222222222 | | 3 | c | 33333333333 | | 4 | d | 44444444 | +----+------+-------------+ 4 rows in set (0.00 sec)
root@db 04:02: [aaaa]> update aaa as t1 set name='e' where id =1; ERROR 1099 (HY000): Table 't1' was locked with a READ lock and can't be updated root@db 04:04: [aaaa]> update aaa set name='e' where id =1; Query OK, 0 rows affected (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 0
root@db 04:04: [aaaa]> insert into aaa select * from aaa; ERROR 1100 (HY000): Table 'aaa' was not locked with LOCK TABLES root@db 04:04: [aaaa]> insert into aaa select * from aaa as t1; ERROR 1062 (23000): Duplicate entry '1' for key 'PRIMARY'
root@db 03:53: [aaaa]> root@db 03:53: [aaaa]> select * from aaa; ERROR 1100 (HY000): Table 'aaa' was not locked with LOCK TABLES root@db 03:53: [aaaa]> select * from aaa as t1; +----+------+-------------+ | id | name | telephone | +----+------+-------------+ | 1 | e | 11111111111 | | 2 | e | 22222222222 | | 3 | c | 33333333333 | | 4 | d | 44444444 | | 5 | f | 5555555 | +----+------+-------------+ 5 rows in set (0.00 sec)
root@db 03:53: [aaaa]> update aaa set name='e' where id =1; ERROR 1100 (HY000): Table 'aaa' was not locked with LOCK TABLES root@db 03:54: [aaaa]> update aaa as t1 set name='e' where id =1; Query OK, 0 rows affected (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 0
MongoDB Enterprise testrepl:PRIMARY> use admin switched to db admin MongoDB Enterprise testrepl:PRIMARY> db.auth('admin1','admin123'); 1 MongoDB Enterprise testrepl:PRIMARY> use test; switched to db test MongoDB Enterprise testrepl:PRIMARY> db.test_collection.find().count(); 844703
MongoDB Enterprise > use admin switched to db admin MongoDB Enterprise > db.auth('admin1','admin123'); 1 MongoDB Enterprise > show dbs; admin 0.000GB config 0.000GB local 0.000GB test 0.031GB MongoDB Enterprise > use test switched to db test MongoDB Enterprise > show tables; test_collection MongoDB Enterprise > db.test_collection.find().count(); 844703