从mysql中的表中删除所有记录 [英] delete all record from table in mysql

查看:188
本文介绍了从mysql中的表中删除所有记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试删除表中的所有记录.我的查询是:

I am trying to delete all records from a table. My query is:

delete from tableName.

但是它报告以下错误:

错误代码:1175.您正在使用安全更新模式,并且试图 更新没有使用KEY列的WHERE的表以禁用安全 模式下,在首选项"->"SQL编辑器"->查询编辑器"中切换选项 并重新连接."

Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL Editor -> Query Editor and reconnect."

我该如何解决?

推荐答案

truncate tableName

这就是您要寻找的.

截断将删除表中的所有记录,清空它.

Truncate will delete all records in the table, emptying it.

这篇关于从mysql中的表中删除所有记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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