Skip to main content

How to Delete a Database

If a database is no longer used, you can delete it using HeidiSQL. Make sure you have connected to the database first.

DATA WILL BE LOST PERMANENTLY

Deleting a database will permanently delete all tables and data inside it and cannot be undone. Back up first if there is still important data — see How to Create a Backup.

Method 1: Via the Menu (GUI)

  1. In the left panel, right-click on the database you want to delete.
  2. Select Drop database.
  3. A confirmation will appear. Type the database name to confirm, then click Yes.

Database deletion confirmation

Method 2: Via an SQL Query

  1. Open the Query tab.
  2. Run the following command (replace the database name with yours):
DROP DATABASE `db_toko`;
  1. Click Run (or F9).
  2. The database and all of its contents will be deleted.

Running the DROP DATABASE command

tip

If you only want to delete certain tables (not the whole database), right-click on the table then select Drop table(s).