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.
Asked
Active
Viewed 190 times
-1
-
What does SSH have to do with this? – womble Jun 26 '18 at 02: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 – Aitazaz Khan Jun 26 '18 at 02:23
1 Answers
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

Tux_DEV_NULL
- 1,093
- 7
- 11