Deleting Tables from a Database with PhpMyAdmin

Posted on by Alex Gorzen | Updated:
Reading Time: 3 minutes

Managing databases and tables from within PhpMyAdmin is usually very straightforward. This guide will demonstrate how to remove columns and tables from a database using PhpMyAdmin.

We must first state that the potential for unintentional data removal can be elevated when working with any database. Before proceeding, it is highly recommended taking a backup before manipulating any data. Also, prior to amending data, we should confirm is not being used in a live environment.

Deleting Tables from a Database with PhpMyAdmin

To begin, log in to PhpMyAdmin with a user that has proper permissions for the database you want to manage. Let’s begin with dropping a column from a table. In this case, the database name is lwtest_wpdb and the table is wp_test. First clicking on the '+' box next to the database name on the left navigation menu will list the tables, then we click on the '+' box next to the table name and go to Columns.

05-01-phpMyAdmin_Main_Page

This brings us to the Structure tab for the wp_test table. It shows the column names and some information about them. Check the box for one or more tables that you want to remove and then click on the Drop Action below the column list.

05-02-Drop_Column

PhpMyAdmin then gives us a prompt showing the command it will run, “ALTER TABLE ‘wp_test’ DROP ‘Stock’;”
So, we can double-check that is the column we want to remove. Click on Yes to confirm, then the column will be dropped.

05-03-Confirm_Drop_Column

This then brings us back to the Structure page and no longer has the Stock column listed there.

To drop an entire table, click on the database name itself from the navigation on the left.

05-04-Database_Name

This brings us to the database’s structure tab that lists all the tables in that database. Check the box next to one or more tables that we wish to remove, and then clicking on the dropdown box below the list has options to Empty and Drop the table(s). If we just want to clear the data but maintain the structure of the table, we can select Empty. We want the table completely gone though, so select Drop.

05-05-Drop_Table

Then PhpMyAdmin gives us one more page to confirm that we want to drop that table. Dropping the table removed all records, all columns, and removes the table name itself from being listed in the database’s structure. Again, if you are not 100% this data should be removed, having a good backup in place beforehand would help with restoring the table or any data if needed. That being said, we can click on Yes to confirm that the table should be dropped.

05-06-Confirm_Drop_Table

And now the wp_test table no longer shows up on the database’s list of tables.

05-07-No_More_Table

Conclusion

Deleting a table from a database is a quick task that can be done through PhpMyAdmin. So simple that it could be done accidentally with only a few clicks. Having recent backups before making any large alterations to a database is always a good idea. Then when going through PhpMyAdmin to drop the table, taking time and reading through the confirmation page before clicking yes could potentially save hours or days worth of downtime! 

Series Navigation
<< Previous ArticleNext Article >>
Avatar for Alex Gorzen

About the Author: Alex Gorzen

Alex Gorzen has been helping others with technology his whole life. He played with computers even before he could read and wants to make sure his children share that same love as they grow up. In his free time, he enjoys gardening, building things, and learning new skills.

Latest Articles

How to use kill commands in Linux

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change the root password in WebHost Manager (WHM)

Read Article