Here's a really simple way fo getting all your Database table and deleting them, without having to write and scripts.
I'm using Terminal on a Mac here and I've SSH'd into the server. And then accessed my database so I can type in my queries directly .
What you want to do here is write a 'DROP TABLE' command that will include all of your tables.
Like
DROP TABLE IF EXISTS A,B,C;
To get a full list of all of your tables you can use.
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE';
Using this list I've copy and pasted this into a text editor. You'll need one the has a decent copy and paste facility.
You'll get something like
| table_one |
| table_two |
Replace
"|"
for
","
And then
Replace
" ,"
for
""
AND then replace the first "," for "DROP TABLE IF EXISTS "
And the last "," for ';"
You can now copy and paste this into terminal.
No comments:
Post a Comment