Delete or drop MySQL database tables

Written by
Date: 2013-05-24 17:12:13 00:00

Delete a MySQL Table

To delete one or more tables on a MySQL database we use the drop command.

Enter the MySQL command interface

mysql -u [user] -p

You will be prompted for for [users]'s password, and then you get the prompt.

Select the database

USE [database_name];

You can now list the tables of the database.


Delete tables from MySQL database

DROP TABLE [IF EXIST] [table 1], [table 2], [table n];

It is a good idea to use the 'IF EXISTS' option, to avoid errors if you are trying to drop a table that does not exists in the database.

Replaces 'table 1', 'table 2' and so on, for the table names you want to delete.