Hey there, hope you’re well and not stressed out, I remember how confused I was when I had to migrate a WordPress website for the first time. Don’t worry, it is really simple. In this article you will learn step by step how to migrate your WordPress website – How to set up – MySQL database & wp-config.php.
If you’re looking for the fastest and cheapest WordPress hosting, get 10Web RN.
If you’re looking for ready made website, visit here.
Here’s the content table
1. Install WordPress on your domain
In case you’re not migrating but just installing, then you can skip the below steps and jump directly here.
Here’s the bigger picture of the process.
- Your website has 2 components, database and the actual website files (codes, images, everything).
- We need to move these 2 from the old hosting/domain to the new one.
Migrating WordPress website:
- Compress & download your current website
- Export your current MySQL database
- Import your database to the new hosting
- Upload your website to the new hosting
- Configurations
Installing WordPress on your website:
- Download .zip WordPress file from here
- Upload WordPress
- Create database, a user, add the database to the user. Make sure to save the password
- Run {your_domain}/wp-activate.php
- Follow the steps, done
2. Required components in the migration process:
- WordPress website .zip format
- Database
- Database user
- cPanel or FTP (in this example I’ll show it on cpanel, the same can be done with FTP)
3. Export and download your current website files: The organized way of preparing the migration
Compress WordPress website
Go to cPanel -> Files manager -> public_html -> find your website’s current location -> Click on the folder -> Click compress -> Choose Zip Archive (rename if necessary) -> Compress files.
After refreshing the page you will find the new zipped file, click it and download it.
MySQL Database export
If you don’t know the name of your data base, firstly, go to cPanel -> Files Manager -> public_html -> find your website’s location -> find the wp-config.php file in the root directory of your website’s wordpress folder -> Click it and click on the edit button -> You will find the name & username of your database.
Now that you know the names:
Go to cPanel -> phpMyAdmin -> Find your database, click it -> Click on export from the top menu -> Go
So now you have two files, your WordPress website zipped and your database. Remember it is crucial to have both 😀
4. Installing WordPress website on your (new) hosting
Being organized is the key to not facing issues afterwards.
Here are the general steps:
- Create new database
- Create new user to the database
- Add the user to the database
- Import the database
- Configure database options
- Upload your WordPress website
- Make the necessary changes to the wp-config.php
- Either Go or re-check everything
Note 1: If you’re using the same cPanel then directly jump to step 5.
2: If you’re migrating to another cPanel, then all the steps below are only on the NEW cPanel.
3: In the steps below, I’m assuming you’ve added your domain to the hosting, or is the main domain of the hosting, so either way, I’m assuming you know where domain directory in the file manager.
1. Create new database
Go to the new cPanel -> MySQL® Databases -> enter your database name -> Create Database
2. Create new user
Go to the new cPanel -> MySQL® Databases -> scroll down to the “MySQL Users” section -> “Add New User” -> enter the name of the database -> enter the password or generate one (copy the password somewhere to save it) -> Create User
3. Add the user to the database
Go to the new cPanel -> MySQL® Databases -> scroll down to the “Add User To Database” section -> choose the new user, the one you just created -> choose the new database, the one we just created -> Add -> check the ALL PRIVILAGES box -> Make Changes
4. Import the database
Go to the new cPanel -> phpMyAdmin -> select the new database -> click on import from top menu -> Choose File -> select the database you downloaded from the old cPanel -> Go
5. Configure database options
Firstly, go to the new cPanel -> phpMyAdmin -> select your database -> from the left menu options find and select wp_options -> you can see your old URL in the first two values of the option_value -> replace both of the URLs with your new URL
6. Upload your WordPress website
Firstly, go to the new cPanel -> File Manager -> public_html -> locate the your new domain’s folder -> Click on upload from the top menu -> Select File -> choose the .zip file that you downloaded from the old hosting -> wait for the upload to finish -> go back to file manager and the folder -> find the zip file you just uploaded, click on it and choose Extract from the top menu -> enter the extracted folder, select all the files and move them one level up.
7. Make the necessary changes to the wp-config.php
Enter the newly added and extracted folder -> find wp-config.php -> click it and choose edit from the top menu -> change the database name, user and password (the password that you copied during database user creation step – step 2).
( ‘DB_NAME’, ‘new_database_name’ );
( ‘DB_USER’, new_database_user’ );
( ‘DB_PASSWORD’, ‘the password you copied’ );
Your website should be working just fine on the new domain/hosting
5. Possible issues you might face after migrating your website
Data base not being uploaded
The issue is usually the file size, your database size could be larger than the allowed file upload size. You have two solutions.
- Compress your database, make sure the extension is .sql.zip then try uploading it. This should fix the issue.
- Change the max upload file size from cpanel.
Payments not working on the new website
If you’re using a custom payment gateway, it is best to contact your payment gateway’s support. Some common issues.
- Whitelist new hosting’s IPs
- Payment gateway’s configurations for the new URL
- Check the error log file, this could be a headache if you’re new to it. You can just download the log and send it to the payment gateway’s support.
New website not working
If your old website is a bit complex, and has been through a lot, it might not work, and the reason would be so tough to identify, you would need an expert to work on it.
Conclusion
Migrating/installing a WordPress website is really simple, therefore, just be organized and try to understand the bigger picture.