Raspberry Pi

How to Delete MySQL Database from Raspberry Pi

Creating a database on the Raspberry Pi system is one of the tasks people mostly do when creating web servers or accessing other servers from the systems. Most people who create databases forget to delete them once they are no longer used on their system. This article will show you how you can easily delete a MySQL database on your Raspberry Pi system.

How to Delete MySQL Database on Raspberry Pi

Deleting a database is simpler than creating it. You can follow the guide here if you don’t know how to create a database and what tools are required for creating a web server.

Once you have a database created on your system, it’s now time to find out the list of databases on your Raspberry Pi system. For this purpose, you first open the MySQL database via the below-mentioned command:

$ sudo mysql

Now, to view the databases list, hit the following command:

show DATABASES;

The above command shows you the MySQL databases list you created on your Raspberry Pi system.

To delete or remove any MySQL database, use the following command:

$ DROP DATABASE <database_name>;

The above command successfully deletes the MySQL database from your Raspberry Pi system and you can now create the same database with the updated information.

You can view the MySQL database list again to confirm the database has been successfully removed.

In this way, you can also remove other databases and free up the MySQL database system.

Conclusion

Removing the MySQL database on the Raspberry Pi system is important since it allows you to clean your database system and remove those databases that are no longer useful. To remove any database, you enter the MySQL database system through the “mysql” command and then view the created databases through the “show DATABASES” command. Afterward, you can choose any database and delete it from MySQL database through the “DROP DATABASE” command.

About the author

Awais Khan

I'm an Engineer and an academic researcher by profession. My interest for Raspberry Pi, embedded systems and blogging has brought me here to share my knowledge with others.