mysql> drop database databasename;
To delete a database from MySQL server, you can use the following SQL command:
sql
DROP DATABASE [IF EXISTS] database_name;
Replace database_name
with the name of the database you want to delete. The IF EXISTS
clause is optional and prevents an error from occurring if the database does not exist.
Here’s an example without the IF EXISTS
clause:
sql
DROP DATABASE mydatabase;
And with the IF EXISTS
clause:
sql
DROP DATABASE IF EXISTS mydatabase;
Make sure you have the necessary privileges to drop the database, and be cautious when executing this command as it permanently removes the database and all its associated data.