How to export data from a single table and import into single table using phpMyAdmin?

How to export data from a single table and import into single table using phpMyAdmin?

There may be times when you need to export data from a single table and import into a single table in an existing database using phpMyAdmin. In this post, we shall discuss how to export data from a single table and import into single table using phpMyAdmin?

 

Here is a scenario when such an activity may be needed for better understanding. This is from my practical experience.
 
So, there is this WordPress website we had, and the theme had to be customized. Since we did not want to disrupt the live site, we took a backup and installed the copy on a development system to further customize the site. During the customization process, we ran into some issues. And to isolate the problem, we disabled some plugins to check if the plugins were interfering with the problem. 
 
The problem was, we were using a WordPress plugin called “Post Views Counter” to display views on each post. During this process of troubleshooting as described above, we had also disabled the “Post Views Counter” plugin (or may even have deleted it from the plugins page in WordPress) . Later when we re-installed /re-enabled the plugin, we found the stats have been reset. The post views were all zeros. And we wanted to retain the values. 
 
After the required customization was done, we needed to bring the stats of “Post Views Counter” from the live site to the development site, before we upload on the live server. Note: there could have been another way to do this, but we did not want to take a risk. More on this described at the end of this post.
 
So here is what we did: to export data from a single table and import into single table using phpMyAdmin.
 
How to export data from a single table using phpMyAdmin?
 
 
To backup only a particular table in phpMyAdmin, click on the particular table and click Export. This will export only the table and not the entire database. 
 
Activities on the live server:
  • Logged in to phpMyAdmin
  • Backed up the entire database (just in case needed)
  • Clicked on the particular table from the left sidebar (ngk_post_views in this case)
  • Clicked Export 
  • This exported only the table (ngk_post_views in this case) in .sql file
Now that we have the backup of the particular table (ngk_post_views in this case), we needed to restore this on the development server.
 
How to import data from a single table using phpMyAdmin?
 
To import data from a single table using phpMyAdmin, the process is the same as importing database. BUT, the table you are importing should not exist. Otherwise, phpMyAdmin will throw an error.

admin

Related Posts

Magnet-controlled bioelectronic implant could relieve pain

Magnet-controlled bioelectronic implant could relieve pain

Using sound and light to generate ultra-fast data transfer

Using sound and light to generate ultra-fast data transfer

New droplet-based electricity generator: A drop of water generates 140V power, lighting up 100 LED bulbs

New droplet-based electricity generator: A drop of water generates 140V power, lighting up 100 LED bulbs

No Comment

Leave a Reply

Your email address will not be published. Required fields are marked *