How to display outstanding transactions in MySQL
P粉176151589
P粉176151589 2023-08-27 16:03:45
0
2
299
<p>I ran some queries without submitting. Then the application is stopped. </p> <p>How do I display these open transactions and submit or cancel them? </p>
P粉176151589
P粉176151589

reply all(2)
P粉726133917

Without an open transaction, MySQL will roll back the transaction on disconnect.
You cannot commit the transaction (IFAIK).

You display threads using

SHOW FULL PROCESSLIST

See: http://dev.mysql.com/ doc/refman/5.1/en/thread-information.html

This won't help you since you can't commit a transaction from a broken connection.

What happens when the connection is interrupted
From the MySQL documentation: http://dev.mysql.com/ doc/refman/5.0/en/mysql-tips.html

See also: http://dev.mysql.com /doc/refman/5.0/en/auto-reconnect.html

How to diagnose and resolve this issue
Check for automatic reconnection:

Make sure to keep the last query (transaction) in the client so that you can resubmit it if needed.
And disable automatic reconnect mode as this is dangerous, implement your own reconnect instead so you know when a drop occurs and can resubmit that query.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!