Importing Databases and Tables with PhpMyAdmin

PhpMyAdmin can help with Importing databases and tables through your browser.
Priyanka Sharma
Priyanka Sharma

Created: 05/23/2020 8:34 AM - Updated: 05/23/2020 8:34 AM


Using PhpMyAdmin to import databases can help us in a few different situations, like when moving a database from one server to another, updating a table that is being developed elsewhere, or even restoring content from a backup.

PhpMyAdmin helps make all those processes easy to accomplish through our browser.


This guide assumes that you have already logged in to PhpMyAdmin.

First, let’s try to import a database into an existing database that still has data in it.

Click on the database name we want to import to from the left-hand navigation.

In this we have taken an example of a live site and taken the database.Also, we will try to restore a backup we saved locally in an SQL format.


Next, we will go to the Import tab on that page. 


Then,  click on the Choose File button and locate the saved file we have saved locally. It can be an uncompressed or compressed file with the zip, gzip, or bzip2 extension. The import page has other options, but just leave them at the default settings, and then click the Go button at the bottom of the page.


Since this database is still storing data, we can quickly drop all the existing tables so it can be restored to that backup sql file. 

We click on the Structure tab to view the existing tables, and next tick the “Check all” box near the bottom. Then, from the dropdown box, we will choose the “Drop” option to completely remove all tables from this database.


PhpMyAdmin will have us confirm these tables should all be dropped as all data in them will be lost for good

So, let’s proceed and click Yes to drop all tables from the database.


This brings us back to the Structure tab and shows that no tables exist. Now, it will no longer have any conflicts with the restore, so we can go back to the Import tab and retry the upload again.


We begin by selecting the file and then clicking on the Go button at the bottom of the window.


Depending on how large the database being restored is, it could take a few minutes to upload and a few more for all the tables to be populated with data. Once this completes, we should see the “Import has been successfully finished” message as well as see the tables in the navigation menu on the left side.



Next, to copy a table into the original database, we will want to empty the existing table. Then, we will go back into the original table and under the Structure tab, we can select Empty for the table we will be copying over. The Empty option will keep the table and its structure, but remove all the records. If the table being copied over has a different structure, then we should use the Drop command on the whole table instead, so the imported table can recreate the structure as well.


 Click OK in the popup asking you to confirm that the data should be removed


Now, we go back to the imported database, under the Structure tab, check the box for the table we want to copy over and then choose the “Copy table” option from the dropdown list near the bottom.


A new box will pop up and ask us what database the table should be copied into. Select our original database (lwtest_wpdb) and then for the Options, select “Data only” if the table was emptied, or “Structure and data” if the table was dropped. Click on the Continue button and it will copy over the table data.


After that, it will run for a bit, depending on the amount of data there is. It will not provide a confirmation if the import succeeds. We will need to navigate back to the original database and visually confirm that the table data was copied back over.



PhpMyAdmin makes it easy to deploy a database with a file you have saved locally without having to log in to a terminal or use any commands.

Was this article helpful?

0 Out of 0 Marked As Helpfull

Have more questions? Please Contact Us