How to Delete a MySQL Database
How to Delete a MySQL Database
This wikiHow teaches you how to use your computer's command line to delete a MySQL database. In order to delete a MySQL database, you must have access to an account with delete privileges, such as the "root" account.
Steps

Open the MySQL Command Line. In order to delete a database in MySQL, you'll need to use the MySQL command line from your computer's Command Prompt (Windows) or Terminal (Mac) program.

Enter the login command. Type in the following, then press ↵ Enter. mysql -u root -p If you don't have access to the root account, enter your own username in place of "root". This must be an account that has read/write privileges.

Enter your password when prompted. Type in the password you use to log into MySQL, then press ↵ Enter.

View a list of your databases. Once MySQL opens, type in the following command and press ↵ Enter to see a list of your MySQL databases: SHOW DATABASES;

Find the name of the database you want to delete. Scroll through the databases until you find the one you want to delete, making sure to note its name as it appears above the database. If you're using a Mac, database names are case-sensitive. This means that if the database's name has capital letters, you'll need to use the proper capitalization in the "delete" command to make sure you delete the correct database.

Delete the database. Type in DROP DATABASE name; where name is your database's name, then press ↵ Enter. For example, to delete a database named "Flowers", you would enter the following command: DROP DATABASE Flowers;

Review your updated list of databases. You can ensure that the database was deleted by re-entering the SHOW DATABASES; command and scrolling through your available databases. The one you deleted should not be present.

What's your reaction?

Comments

https://chuka-chuka.com/assets/images/user-avatar-s.jpg

0 comment

Write the first comment for this!