![](/img/trans.png)
[英]How can I get a list of all tables and views used in the from clause of tables and views in a MYSQL Database?
[英]How can I remove all tables from mySQL database with phpAdmin?
我需要一個簡單的命令來刪除數據庫中的所有表。 找不到它。 就像是
DELETE ALL TABLES of `db1231123`
如何在phpMyAdmin中重置數據庫
注意:如果一遍又一遍地重新創建相同的數據庫對象,則可能需要保存在步驟6中生成的腳本。然后,實際上在下次要再次刪除所有表時執行SQL。
您還可以使用以下語句生成必要的DROP TABLE
語句:
SELECT CONCAT('DROP TABLE IF EXISTS ', table_name, ';')
FROM information_schema.tables
WHERE table_schema = 'your-db-name';
獲取該查詢的輸出,並在其周圍放置以下SET FOREIGN_KEY_CHECKS
語句:
SET FOREIGN_KEY_CHECKS = 0;
-- here come the generated statements, for example:
DROP TABLE IF EXISTS users;
DROP TABLE IF EXISTS companies;
-- ... etc.
--
SET FOREIGN_KEY_CHECKS = 1;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.