The WordPress database is where your blog data and information is stored. Without that database, WordPress is just a software that cannot work, as WordPress is a mix between MySQL database and PHP language. But, when a newbie wants to move to a new hosting server, they find themselves lost in lots of details, and things to do in order to migrate their blogs easily.
Luckily, there is no problem at all if you follow this step by step tutorial on how to move the WordPress database to your new server. What you need is 5 minutes, and the database will be moved using one of the below main methods:
How to move WordPress database from cPanel
This is the easiest way to migrate any MySQL database. It lets you move WordPress sites to a new server without problems. All you have to do is login to your cPanel account first, then locate the icon named “Backups” in the files tab, as the below screenshot:
Now, you will get the next page and you have to select the database that you want to download to your computer. Then, upload it to the new hosting, forget the first part of the page that says “Full Backup”, and focus only on the next part that says”Partial Backups”. If you have one single website, you will find a single database name as the below example, and you need to click on it, in order to start the download.
The database file will be automatically downloaded to your computer, just remember its location.
Now that we have learned how to download the database from cPanel, we need to restore it on the new server, and add it automatically to the new WordPress installation, without doing anything.
How to restore a database in cPanel
I’ll show you two ways to move MySQL databases to a new server, the first one works only when you have the same WordPress installation, and all the files as the old server or host. In other words, this is only valid when you move all your blog from another server.
To restore your WordPress database, login the new cPanel account, and click the same icon that you’ve used above, it’s the “Backups” and in the same page as above. You just need to focus on the right part of the page, where you see the “Upload” buttons.
You have a MySQL database to restore. So, use the “Restore a MySQL Database” area and click “Upload” as the screenshot below:
After uploading the database, you will see a page with slots of information and that’s the successful restore.
The second way to restore the WordPress database works for both, new and old installations. We will replace all the actual installation database tables, with the old one in a few clicks. First, come back to the cPanel and find an icon called ”phpMyAdmin” in the “Databases” tab, and click on it as below:
In the next step, you will get the phpMyAdmin interface and you need to click the name of your new database that was created with the new installation (or the old installation as well). The database name is located on top the left page as below, and you need to click the “import” option, at the top of the page:
Choose the file from your computer, and then scroll down the above page example and click the “Go” button. Wait until the database successfully uploads and that takes a few minutes, if you have a large database. Then it’s done, you don’t have to edit any file, or do anything else, because the database was imported in the actual database.
So, it will save the same name but it replaces the new tables with the old ones. You have a new blog or website on a new server, but with the old database and files.
How to migrate WordPress database using phpMyAdmin
This is another method to move MySQL databases from phpMyAdmin dashboard, and it’s needed when you have issues with the above methods. As the above example, login to cPanel and click the phpMyAdmin icon. Then, select the database that you want to copy, and download, click “Export” link at the top of the page:
Then, you will get the file that’s not compressed this time, and you need to save it locally. The next step will be uploading this database to the new hosting server. You need to login to the same page phpMyAdmin. Next, select the new database name, and you will get all the tables.
Then, you can just click the “import” database option, at the top and select the downloaded file from your computer, and it’s done.
Please remember, you can upload only compressed files that are in gzip, bzip2 or zip format and all the above downloading methods will result in a supported format, don’t worry about that.
That’s it, your WordPress database is just moved to the new server, and you can log into your blog and start working properly.