mysql只删除表不删除库

1.备份数据库
mysqldump -uroot -P13306 -h10.1.50.14 -p 库名 > /opt/20190109.sql
2.删除所有表
mysql -uroot -P13306 -h10.1.50.14 -D 库名 -p -e "SELECT CONCAT('drop table ',table_name,';') FROM information_schema.TABLES WHERE table_schema='库名'" > /opt/drop.sql
mysql -uroot -P13306 -h10.1.50.14 -p ghw < /opt/kstore_drop.sql

原文地址:https://www.cnblogs.com/python-cat/p/10244387.html