How can I undo a mysql statement that I just executed?
问题 How can I undo the most recently executed mysql query? 回答1: If you define table type as InnoDB, you can use transactions. You will need set AUTOCOMMIT=0 , and after you can issue COMMIT or ROLLBACK at the end of query or session to submit or cancel a transaction. ROLLBACK -- will undo the changes that you have made 回答2: You can only do so during a transaction. BEGIN; INSERT INTO xxx ...; DELETE FROM ...; Then you can either: COMMIT; -- will confirm your changes Or ROLLBACK -- will undo your