MySQL Forums :: Database Administration & Monitoring :: Drop all tables

Advanced Search

Re: Drop all tables
Posted by: Umesh Shastry ()
Date: April 11, 2006 03:15AM


Not sure whether this is a good practice to do so..but it works fine for me..(make sure the user have file privilege & the server has Information_schema database..)

Things to change here..
test- Name of the database

C:\MySQL5.1.7\bin>mysql -uroot test
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 50 to server version: 5.1.7-beta-community

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> SELECT concat('DROP TABLE',' ',table_name,';')
-> INTO OUTFILE "c:/umesh.sql"
-> FROM information_schema.TABLES
Query OK, 2 rows affected (0.02 sec)

mysql> source c:/umesh.sql;
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)


Umesh Shastry

Options: ReplyQuote

Subject Written By Posted
Drop all tables Sarah Castillon 04/11/2006 02:19AM
Re: Drop all tables Umesh Shastry 04/11/2006 03:15AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.