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 521 times
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,123