November 28, 2016

How to drop all tables in mysql database using a single command

Command:-
mysqldump -u[user] -p[password] --add-drop-table --no-data [DATABASE] | grep ^DROP | mysql -u[user] -p[password] [DATABASE]

Here test is the database name. I'm going to drop all the tables from this database.
Example:-
mysqldump -uroot -predhat --add-drop-table --no-data test | grep ^DROP | mysql -uroot -predhat test

No comments:

Post a Comment

How to Patch Oracle 19c to Release 19.30 on Windows – A Complete Step-by-Step Blog

  As soon as   Oracle released quarterly patch for Jan 2026 , I had to patch one of my Oracle 19c databases from 19.25 to 19.30. Since this ...