-1

I am totally new to the ssh so pardon if I commit any mistake. Well, I have had 457 databases which i wanted to take backup and put databases in individual files. Which i got a working solution from this Answer. Now I have dumped all the databases now i want to delete/drop all the databases from MySQL. I have googled alot but didn't find a useful resource to my question or maybe i am not aware of terms so truly seeking for help.

2
  • What does SSH have to do with this?
    – womble
    Jun 26, 2018 at 2:21
  • Actually, i have shared web hosting from Bluehost and they blocked my access to PhpMyAdmin now the only way i have to use ssh to backup all of my databases and then delete it. The dumping part is done but deletion part is remaining Jun 26, 2018 at 2:23

1 Answer 1

2

You will need the command DROP DATABASE database_name and need to do this for all databases. I do not think there is one command that will delete all databases at once.

You may try this while loop:

echo "show databases;" | mysql -u <username> -p <password>|while read databasename 
     do echo deleting $databasename
     drop database $databasename 
done 
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .