Mysql commit, rollback, and savapoint attack path-
Generally
After installing mysql
Set autocommit = true;
The SQL statement cannot be rolled back every time it is executed.
Now we want to test commit
We can
Use test;
(Use the test database)
Then
Set autocommit = false;
If you do not execute
Commit;
Data is stored in the memory at most and will not be written to the database.
Once we commit; then the database will be submitted to the database.
Of course
Before commit, we can rollback; before returning to the database to commit
However, this rollback is equivalent to rolling back all of your previous operations, which means that the previous operations are useless.
So we usually get an archive at the point we want to save, just like the Restore Point in windows.
For example, after I finish this SQL statement
Executed
Savepoint p1;
Restore point p1 is created;
Then, execute the next SQL statement to delete
Then
I executed
Rollback to t1;
In this way, you can return to the archiving point of t1, just like playing a game! Unhappy with the previous progress
Of course, after you execute commit!
You cannot implement rollback! REMEMBER !!!!!!!!!!!!!
As a Cainiao!