If you ‘re in the process of migrating your blog to a new hosting or want to clean your actual server and start from the beginning, your big problem is how to import WordPress database in PHPMyAdmin. It’s one of the methods to import your blog database, but, it’s the best and the easiest way. Today, I’m going to show you how to restore your database tables that contain the data and everything else like posts and options.
The WordPress software work with the database that store all the data and information, so you should import a database to be able to make the blog working as normal.
The biggest mistake that people still making today is to make the migrating process more complicated and risky. They think that they should import all their blog files and just link the database. Of course, this method works, but it needs some knowledge to avoid errors, and never get the famous error “Unable to locate database connection”.
Problems start when you change the database name, password and username. Not all people can remember their details, so, why use that complicated method when you can just re-install WordPress and bring the old database? It’s easiest and best of all, you don’t need to edit or change any details.
Importing WordPress Database
To import any WordPress database through the PHPMyAdmin, you have two options, the first one is importing the database with the old installation. It’s the difficult method that I never recommend.
The second one by installing a fresh WordPress and replacing the actual database with your old one. It’s easy and never risk your site.
The process is simple, to be able to restore a WordPress blog, you can just restore the next two files:
You can add themes and plugins if you want, but you can easily restore your blog from the uploads and the database backups.
After installing WordPress on the new server, just delete the upload file and upload your old uploads in the same location. If you need more details you just need to take a look at How to restore a WordPress blog.
To import the database, you need to delete the new database and replace it with the old one. So, login to cPanel, and locate the PHPMyAdmin icon, and click on it.
Then, you get a the PHPMyAdmin page, just look at the top left area, and find your new database name. Then, click on it as below:
Now, you will get many tables that store all your new WordPress details. Until now, you have a fresh installation, so, how import the old tables, posts, and plugins settings? The response is deleting the actual tables, then import the old database in the same place. So, scroll down and to find the “Check all” option, and select “drop”, to delete all the actual tables as the screenshot, below.
After deleting these tables, you need to import your old database. It should be in sql, gzip, bzip2, and zip format.
If you have a compressed database file, it should end with sql.zip to be able to upload it.
Next, click on ”import” at the top of the page.
And you can upload your file directly from the next page:
Now, you should get a successful message after uploading the database file.
After importing the old database, you don’t need to do anything to make your blog functional as it was. The ”uploads” directory that you have uploaded will communicate through WordPress with your database, and restore all your posts, images, featured images and everything.