

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How do I remove a MySQL database?
To remove any database, we need to use DROP command in MySQL. Here is the syntax.
DROP DATABASE yourDatabaseName;
First, let us check how many databases are present in MySQL. Here is the query for the same.
mysql> SHOW DATABASES;
The following is the output.
+--------------------+ | Database | +--------------------+ | business | | database1 | | databasesample | | education | | hello | | information_schema | | javadatabase | | javadatabase2 | | javasampledatabase | | mybusiness | | mydatabase | | mysql | | performance_schema | | sample | | sampledatabase | | schemasample | | sys | | test | | test3 | | universitydatabase | +--------------------+ 20 rows in set (0.00 sec)
As displayed above, we have total 20 databases in MySQL. Here, let us try to remove database ‘javadatabase’.
The following is the query to remove database.
mysql> DROP DATABASE javadatabase; Query OK, 0 rows affected (0.19 sec)
We have successfully removed the “javadatabase”. To verify, let us check with the help of SHOW command.
mysql> show databases;
The following is the output.
+--------------------+ | Database | +--------------------+ | business | | database1 | | databasesample | | education | | hello | | information_schema | | javadatabase2 | | javasampledatabase | | mybusiness | | mydatabase | | mysql | | performance_schema | | sample | | sampledatabase | | schemasample | | sys | | test | | test3 | | universitydatabase | +--------------------+ 19 rows in set (0.00 sec)
The above output displays 10 databases now i.e. we have successfully removed the “javadatabase”. Now, you can’t find any database with the name “javadatabase”.
- Related Questions & Answers
- How do I remove a uniqueness constraint from a MySQL table?
- How do I show the schema of a table in a MySQL database?
- How do I see what character set a MySQL database / table / column is?
- How do I remove a property from a JavaScript object?
- How do I select four random tables from a MySQL database having thousands of tables?
- How do I get the id after INSERT into MySQL database in Python?
- How do I drop a MongoDB database from the command line?
- How do I access SQLite database instance on iPhone
- How do I create a view in MySQL?
- How do I remove ON UPDATE CURRENT_TIMESTAMP from an existing column in MySQL?
- How do I remove multiple elements from a list in Java?
- How do I remove all elements from a list in Java?
- How to remove special characters from a database field in MySQL?
- How do I insert a record from one Mongo database into another?
- How do I remove lines between listviews on Android?
Advertisements