Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mysql 5.5lock tables and implicit transaction commit commit

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Conclusion: lock tables can implicitly commit uncommitted transactions of other sessions

Test details:

-session 1

Mysql > start transaction

Query OK, 0 rows affected (0.00 sec)

Mysql > show databases

+-+

| | Database |

+-+

| | information_schema |

| | mysql |

| | performance_schema |

| | test |

+-+

4 rows in set (0.00 sec)

Mysql > use test

Database changed

Mysql > create table t_commit (an int)

Query OK, 0 rows affected (0.04 sec)

-session 2

Mysql > select count (*) from test.t_commit

+-+

| | count (*) |

+-+

| | 0 |

+-+

1 row in set (0.01 sec)

-session 1

Mysql > insert into t_commit values (1)

Query OK, 1 row affected (0.01sec)

-session 2

Mysql > lock tables test.t_commit read local

Query OK, 0 rows affected (0.00 sec)

Mysql > select count (*) from test.t_commit

+-+

| | count (*) |

+-+

| | 1 |

+-+

1 row in set (0.00 sec)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report