如何删除MySQL中的所有表?
我不想删除数据库,
因为我不在自己的计算机上托管网站,
删除数据库将需要重新创建它,以及许多设置。
MySQL中有没有一个命令可以用来删除特定数据库中的所有表?
编辑
我能做的一切都在phpMyAdmin中
I don't want to drop database,
because I'm not hosting the website on my own machine,
drop the database will require create it again,and many settings.
Is there a command in MySQL that can be used to delete all tables in a specific database?
EDIT
Everything I can do is within a phpMyAdmin
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您正在谈论在 phpMyAdmin 中执行此操作。
我只是必须这样做,我不确定您正在使用什么版本,但在我的版本中,如果您滚动到表格列表的底部,您可以单击“全部检查”,然后在旁边的下拉列表中有“选择:”,您可以选择“删除”,它会清空所有表。
You were talking about doing this in phpMyAdmin.
I just had to do this and I'm not sure what version you are using but in the version I have if you scroll to the bottom of the table list you can click "Check All" and then in the drop down next to it that has "With Selected:" you can select "Drop" and it empties all the tables.
这里还有更多方法可以删除所有表而不删除数据库。
Here there are more methods to drop all tables without dropping the database.
您还可以从 information_schema 数据库生成一个 sql 文件:
这将给出如下输出:
You can also generate a sql file from the information_schema database:
This will give an output like:
我不知道有什么可以直接满足您的需求。您可以尝试执行以下操作:
运行此命令以显示您的放置命令:
接下来,您可以这样做来实际执行 drop 命令:
I'm not aware of anything direct to suit your needs. You might try doing the following:
Run this to show your drop commands:
Nex you can do this to actually execute the drop commands:
它对我有用!
it work for me!
如果您的表名只有简单的名称(没有空格或其他特殊字符),则此查询可以为您构建整个 drop 命令:
If your table names have only simple names (no spaces or other special chars) this query could build the whole drop command for you: