第一个连接:
MariaDB [(none)]> START TRANSACTION;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> INSERT INTO t2 VALUES(1),(3);
ERROR 1046 (3D000): No database selected
MariaDB [(none)]> use test
Database changed
MariaDB [test]> INSERT INTO t2 VALUES(1),(3);
Query OK, 2 rows affected (0.02 sec)
Records: 2 Duplicates: 0 Warnings: 0
不提交此交易
第二次连接
MariaDB [test]> SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED ;
Query OK, 0 rows affected (0.00 sec)
MariaDB [test]> SELECT * FROM t2;
+------+
| i |
+------+
| 1 |
| 3 |
+------+
2 rows in set (0.00 sec)
MariaDB [test]> COMMIT ;
MariaDB [test]> select * from t2;
Empty set (0.00 sec)