To delete a table from a database, open phpMyAdmin, select the table, and use the Drop option. Dropping a table permanently deletes the table and all the data in it, so back up the database first.
Before you start
Dropping a table cannot be undone. Make sure no website or application still uses the data in the table.
To back up the database, open the Export tab in phpMyAdmin and create an export file. If you are on a WordPress Hosting plan, you can also restore an earlier copy with JetBackup.
If you are not sure which panel your plan uses, check your welcome email or log in to the client area at https://my.hostking.host. Plans use either cPanel or DirectAdmin.
Delete a table in cPanel
Steps for cPanel
- Log in to cPanel.
- In the Databases section, click phpMyAdmin.
- In the left pane, click the name of your database.
- Tick the checkbox next to the table you want to delete. To delete several tables, tick each one.
- From the With selected list, choose Drop.
- Confirm the prompt by clicking Yes or OK.
- Refresh the page and check that the table no longer appears in the list.
Alternative route in cPanel
- Click the name of the table you want to delete.
- Open the Operations tab.
- Scroll down and click Delete the table (DROP).
- Confirm the prompt.
Delete a table in DirectAdmin
Open phpMyAdmin in DirectAdmin
- Log in to DirectAdmin.
- Open phpMyAdmin from the DirectAdmin menu. The exact menu label can vary, so look for phpMyAdmin in the database or extra features section.
If you see the message "Access to phpMyAdmin is only allowed from control panel", open phpMyAdmin from DirectAdmin rather than typing its address into your browser.
Steps for DirectAdmin
- In phpMyAdmin, click the name of your database in the left pane.
- Tick the checkbox next to the table you want to delete.
- From the With selected list, choose Drop.
- Confirm the prompt.
- Check that the table no longer appears in the list.
Troubleshooting
Error: you do not have permission to drop the table
The database user does not have the DROP privilege. In DirectAdmin, open the database and select Modify Permissions to check the user's privileges. Ask your site administrator or contact support if you cannot change them.
Error: foreign key constraint
Another table in the database refers to this table through a foreign key, so phpMyAdmin will not delete it. Check the database structure before you try again, or contact support for help.
Site stops working after deleting a table
The site or application may rely on the deleted data. Restore the database from your backup.
Table with a timestamp in its name
A website restore can create extra tables with a timestamp at the end of the name. Check that your site does not use the table before you drop it.
Need more help?
Use live chat on the Hostking website, or open a support ticket from the client area.
