Deleting databases in MYSQL problem asking...

Hi,

I'm the new user of mysql. I facing one problem to delete one of the database in mysql. Hope can get all of your suggestion and advice.

Input:

mysql> show databases;
+-------------------------+
| Database                |
+-------------------------+
| information_schema      |
| mysql                   |
| test                    |
+-------------------------+
3 rows in set (0.00 sec)

Output:

mysql> show databases;
+-------------------------+
| Database                |
+-------------------------+
| information_schema      |
| mysql                   |
+-------------------------+
 2 rows in set (0.00 sec)

My purpose just would like to delete the "test" database. What command like or shell script I can create to archive my aims to delete the "test" database? Thanks a lot for any sharing and advice.

From the MySQL Reference Manual, chapter 12, Section 1, Command 21

drop database test

Be advised that this is a DDL statement that cannot be undone, unless you have a backup.

Hi
you may use the following in a script :-

mysql -u root -p<ur password> -e "drop database test"

cheers

Thanks a lot, pludi.
Your code work perfectly and solve my problem :slight_smile:
Thanks for your suggestion.

---------- Post updated at 01:56 AM ---------- Previous update was at 01:56 AM ----------

thanks for sharing :slight_smile:
that is another way for me to solve my problem too ^^