How can I drop all tables in my database ?
1) In one MYSQL command
2) Without destroying and creating the database ?
Thanks
To drop multiple tables in phpMyAdmin select the page which shows all the tables for a database. Tick the boxes for the tables you want to delete, and select "Drop" from the "With selected:" drop down box. This is shown in the screenshot below where all three tables have been checked: categories, orders and products.
You can select all the available tables from the right sidebar, right click and choose Delete.. , or press Delete key to drop all.
Try something like this:
mysqldump -u[USERNAME] -p[PASSWORD] --add-drop-table --no-data [DATABASE] | grep ^DROP | mysql -u[USERNAME] -p[PASSWORD] [DATABASE]
Neat little trick, and it works for me.
Originally suggested here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With