The WordPress database is where your blog data and information are being stored. Without that database, WordPress is just a software that can’t work, as it’s a mix between MySQL and PHP. But, when beginners want to move to a new hosting server, they find themselves lost in lots of details, and things to do, in order to migrate their sites easily.
Luckily, there is no problem at all if you follow this step by step tutorial, you will find how to move a 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.
You can read also: How to repair all WordPress tables in MySQL database using PhpMyAdmin.
WordPress database migration
The following are the best ways to migrate a WordPress database to a new web hosting account.
1. Move a WordPress database using cPanel
This is the easiest way to migrate any MySQL database. It lets you move any WordPress site to a new server without problems. All you have to do is login to your cPanel account first, then locate the icon called “Backups” in the files tab, as the following screenshot.
Now, you will get the next page, and you have to select the database that you want to download to your computer. Next, upload it to the new hosting server, forget the first part of the page that says “Full Backup”, and focuses only, on the next part that says”Partial Backups”.
If you have one single website, you will find a single database name, as the following 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 the cPanel, you need to restore it on the new server. It will be added automatically to the new WordPress installation, without doing anything.
Restore the WordPress database in cPanel
I’ll show you two ways to move a MySQL database to a new server. The first one works only when you have the same WordPress installation and all the files as the old server and the hosting provider. In other words, this is only valid, when you moved 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 on the same page as the above example. 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 this screenshot example.
After uploading the database, you will see a page with lots of information, and that’s the successful restoring.
The second way to restore the WordPress database works for both, the new and the old installations. You 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.
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 the top left area of the 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 in the above page example, and click the “Go” button. Wait until the database successfully uploaded and that takes a few minutes, especially, if you have a large database.
Then it’s done, you don’t have to edit any file, or doing anything else because the database was imported into the actual database. So, it will save the same name, but it replaces the new tables with the old ones. Thus, you have a new blog or website in a new server, but with the old database and files.
2. WordPress database migration using phpMyAdmin
This is another method to move your MySQL database from the 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.
Next, 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 phpMyAdmin account. 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 method will result in a supported format, so, don’t worry about that.
That’s it, your WordPress database was just moved to the new server, and you can login to your blog and start working properly.