- Becoming Familiar with Databases in PhpMyAdmin
- Running SQL Queries on a Database with PhpMyAdmin
- Searching Through a Database with PhpMyAdmin
- Creating Tables in a Database with phpMyAdmin
- Deleting Tables from a Database with PhpMyAdmin
- Importing Databases and Tables with PhpMyAdmin
- Exporting Databases and Tables with PhpMyAdmin
- Renaming Database Tables with PhpMyAdmin
- Copying a Database Table with PhpMyAdmin
- Inserting Fields into Database Tables with PhpMyAdmin
- Modifying Fields in Database Tables with PhpMyAdmin
- Deleting Fields from Database Tables with PhpMyAdmin
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.
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.
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.
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.
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.
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.
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.
And now the wp_test table no longer shows up on the database’s list of tables.
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!