back home

Drop all tables in MySQL

March 23, 2019

Export database with empty table data

$ mysqldump --add-drop-table --no-data -u root -p db_name | grep 'DROP TABLE' ) > drop_all_tables.sql

Restore the empty database

$ mysql -u root -p db_name < drop_all_tables.sql

Restore your new tables

mysql -u root -p db_name < database_new.sql