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

Datapatch Fails in Oracle 12c on Windows – Root Cause and Step-by-Step Fix

   Recently, while applying a patch on an Oracle 12c (12.2.0.1) database on Windows, I ran into a frustrating issue: datapatch kept failin...