How To Export Data From A Single Table And Import Into Single Table Using Phpmyadmin?

here may be times when you need to export data from a single table and import into a singl 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 duduk kasus 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
here may be times when you need to export data from a single table and import into a singl How to export data from a single table and import into single table using phpMyAdmin?


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.

here may be times when you need to export data from a single table and import into a singl How to export data from a single table and import into single table using phpMyAdmin?


Activities on the development server:
  • Logged in to phpMyAdmin
  • Backed up the entire database (very important)
  • Click on the database
  • Then select the table we intent to import, and click drop (table)
here may be times when you need to export data from a single table and import into a singl How to export data from a single table and import into single table using phpMyAdmin?

  • Then select the database again, just in case it is not selected
  • Click on import and select the backup file of the table downloaded from the live server
here may be times when you need to export data from a single table and import into a singl How to export data from a single table and import into single table using phpMyAdmin?

  • If every thing goes well, the import should success (unless there are other issues, which we did not encounter)
here may be times when you need to export data from a single table and import into a singl How to export data from a single table and import into single table using phpMyAdmin?

  • We clicked on the table and checked the values and the counts were restored.
  • Viewed the posts on the site's front end, and we could see the counters restored.
Now that the post view counts have been restored, we migrated the site to the live server. 

By the way, to upload your WordPress website to live server,  you can use plugins like "Duplicator". Here is a previous post on -How to use "Duplicator – WordPress Migration Plugin" to migrate development site to live site?

As mentioned above, this could have been achieved in another way.
We could have "dropped" the post views table from phpMyAdmin of the development system and then exported the database. When this is imported on the live server, the post views table on the live server database is expected to be as it is. Ensure backups are taken before attempting any of the examples in this post, and at your own risk.






Sumber http://techubber.blogspot.com/

1 Response to "How To Export Data From A Single Table And Import Into Single Table Using Phpmyadmin?"

  1. It is included in my habit that I often visit blogs in my free time, so after landing on your blog. I have thoroughly impressed with it and decided to take out some precious time to visit it again and again. Thanks. Shipping Containers

    ReplyDelete

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel