How to undo a query execution in phpmyadmin
You can go to the processes
page and press 'kill'
If the statement is still running you can use KILL QUERY <thread_id>
.
If the statement has completed but you have not yet committed the transaction you can use ROLLBACK
.
If the statement has completed and the transaction is already committed (or you didn't start a transaction) then restore the data from your most recent backup.
Also here are some tips advice in order to prevent this type of situation happening in the first place:
- When writing a DELETE or UPDATE always write the WHERE clause first so that you don't forget it.
- Test your WHERE clause in a SELECT statement to make sure you are updating the correct rows.
- If you know you should only be updating one row then you can add LIMIT 1 to your UPDATE statement. Then if despite using the above techniques you still have an error at least only one row will be affected, not the entire database.
if you deleted something then i dont think its going to come back unless you had a backup.I know in sql you can sometimes get away will the ROLLBACK call before you commit to a series of SQL commands but Only in transactions, and you have to have them started first (which phpMyAdmin doesn't use).