2

I need to delete all the tables from my database name "marketing" for magento. I am a beginner so I don’t know much.

please help me , as I can not drop my database.

Thanks,

Divyang

divyang
  • 63
  • 1
  • 7
  • 5
    possible duplicate of [Truncate all tables in a MySQL database in one command?](http://stackoverflow.com/questions/1912813/truncate-all-tables-in-a-mysql-database-in-one-command) – Danyal Sandeelo Sep 18 '15 at 06:27
  • you wanted to drop tables? or you want to delete records from all your DB database tables? – Vishal Sep 18 '15 at 06:28
  • i have tried with " mysql -uroot -ppassword -Nse 'show tables' typo3_6 | while read table; do mysql -e "truncate table $table" typo3_6; done " as root is my user and password is my password . but got Access denied for user error. – divyang Sep 18 '15 at 06:37
  • @divyang , you can drop the tables. – user3040610 Sep 18 '15 at 08:59

1 Answers1

1

You can use below single line command directly from linux server but first test on any testing environment before executing it for safe side.

mysql -uroot -p<pass> -Nse 'show tables' margeting | while read table; do mysql -uroot -p<pass> marketing -e "drop table $table"; done

If you want to do it manually then use below steps-

First get all tables-

show tables from margeting;

Now prepare drop command you can do it in excel etc like-

use marketing;
drop table mytable1;
drop table mytable2;

Now you can execute these statements from anywhere like from any query browser etc-

Zafar Malik
  • 6,734
  • 2
  • 19
  • 30