Home  >  Article  >  Database  >  How to start mysql transaction

How to start mysql transaction

WBOY
WBOYforward
2023-05-31 17:58:061078browse

1. Explicitly start transaction statements, begin or start transaction, submit commit, and rollback.

2. Set autocomit=0, this command will automatically close this thread. As long as the select statement is executed, the transaction will start and will not be automatically committed until comit or rollback is actively executed or the connection is disconnected.

Example

------------
TRANSACTIONS
------------
 
---TRANSACTION 906574, ACTIVE 383 sec
1 lock struct(s), heap size 1136, 0 row lock(s), undo log entries 1
MySQL thread id 71, OS thread handle 139874604435200, query id 9040045 172.17.0.1 server_234

The above is the detailed content of How to start mysql transaction. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete