mySQL / MariaDB - Drop a table

by
Jeremy Canfield |
Updated: January 10 2022
| mySQL / MariaDB articles
The drop <table name> command can be used to drop a table in a database. You will first need to log into your MariaDB or mySQL server or configure passwordless authentication and then use the -e command line option and the user must have the Drop_priv.
You will probably want to first list the tables in the database. One option is to first use the use <database name> command and then issue the show tables command. In this example, the database named db001 will be used.
use db001; show tables;
Or like this.
show db001.tables;
Something like this should be returned.
+------------------+
| Tables_in_db001 |
+------------------+
| table001 |
| table002 |
+------------------+
In this example, table002 is dropped.
drop table db001.table002;
Did you find this article helpful?
If so, consider buying me a coffee over at