如何在phpmyadmin中撤消查询执行 [英] How to undo a query execution in phpmyadmin

查看:140
本文介绍了如何在phpmyadmin中撤消查询执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在phpmyadmin中撤消查询执行.

How to undo a query execution in phpmyadmin.

有任何回滚功能吗?任何人都知道解决方案对我有帮助吗?

Any rollback functionality is there? any body knows the solution kindly help me?

推荐答案

如果该语句仍在运行,则可以使用

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:

  • 编写DELETE或UPDATE时,请始终先编写WHERE子句,以免忘记它.
  • 在SELECT语句中测试您的WHERE子句,以确保您要更新正确的行.
  • 如果您知道只应更新一行,则可以将LIMIT 1添加到UPDATE语句中.然后,如果尽管使用了上述技术,您仍然遇到错误,则至少将只影响一行,而不是整个数据库.

这篇关于如何在phpmyadmin中撤消查询执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆