Photo by Tran Mau Tri Tam ✪ on Unsplash
How to Manually Migrate WordPress from One Server to Another for Beginners
Step-by-Step Guide with Code and MySQL Queries
Manually Migrate WordPress from One Server to Another
Migrating a WordPress website from one server to another can seem like a daunting task, especially for beginners. However, with careful planning and execution, it can be a smooth and successful process. In this article, we will provide you with a step-by-step guide on how to manually migrate a WordPress website from one server to another, along with the necessary code snippets and MySQL queries.
Pre-Migration Checklist:
Before starting the migration process, it's important to perform a few preliminary tasks:
Take a backup: Create a backup of your WordPress website, including both the files and the database. This will serve as a safety net in case anything goes wrong during the migration process.
Update WordPress and plugins: Make sure your WordPress installation and all plugins are up-to-date to avoid any compatibility issues during the migration process.
Note down server details: Take note of the server details of both the source and destination servers, including the FTP login credentials, database name, username, password, and host details. You will need these details during the migration process.
Migration Steps:
Step 1: Export the Database
Access the phpMyAdmin tool on the source server.
Select the database associated with your WordPress website.
Click on the "Export" tab, and select the "Quick" export method.
Click on the "Go" button to download the SQL file containing the database.
Step 2: Download WordPress Files
Connect to the source server using FTP or a file manager tool.
Navigate to the root directory of your WordPress installation.
Download all the files and folders to your local computer.
Step 3: Upload WordPress Files to Destination Server
Connect to the destination server using FTP or a file manager tool.
Navigate to the root directory of your WordPress installation.
Upload all the files and folders from your local computer to the destination server.
Step 4: Create a New Database on Destination Server
Access the phpMyAdmin tool on the destination server.
Click on the "New" button to create a new database.
Enter a unique name for the new database, and click on the "Create" button.
Step 5: Import the Database
Access the phpMyAdmin tool on the destination server.
Select the database you created in Step 4.
Click on the "Import" tab.
Click on the "Choose File" button, and select the SQL file that you downloaded in Step 1.
Click on the "Go" button to import the database.
Step 6: Update WordPress Configuration
Access the destination server using FTP or a file manager tool.
Locate the "wp-config.php" file in the root directory of your WordPress installation.
Open the "wp-config.php" file in a text editor.
Update the following database details with the ones of the destination server:
Save and close the "wp-config.php" file.
define('DB_NAME', 'your_database_name');
define('DB_USER', 'your_database_username');
define('DB_PASSWORD', 'your_database_password');
define('DB_HOST', 'your_database_host');
Step 7: Update URLs in the Database
Access the phpMyAdmin tool on the destination server.
Select the database you imported in Step 5.
Click on the "SQL" tab.
Run the following MySQL queries, one at a time, to update the URLs in the database:
UPDATE wp_options SET option_value = replace(option_value, 'old_url', 'new_url') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, 'old_url', 'new_url');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'old_url', 'new_url');
Note: Replace 'old_url' with the URL of your source server and 'new_url' with the URL of your destination server.
Step 8: Verify Site Functionality
Access your WordPress website on the destination server using the new URL.
Verify that all the pages, posts, images, and plugins are functioning correctly.
Test all the forms, links, and functionalities on your website to ensure everything is working as expected.
Post-Migration Checklist:
After completing the migration process, it's important to perform a few post-migration tasks:
Update DNS: If you have changed the domain name or server, update the DNS settings of your domain to point to the new server.
Test Site Speed and Performance: Check the site speed and performance on the new server to ensure optimal performance.
Update Backup and Security Plugins: If you are using any backup or security plugins, update their settings to reflect the changes in the new server.
Check for Broken Links: Scan your website for any broken links or missing images, and fix them if necessary.
Test Contact Forms and Email Notifications: Test all the contact forms on your website to ensure they are sending emails correctly.
Conclusion:
Migrating a WordPress website from one server to another may seem overwhelming at first, but by following the above step-by-step guide and performing the necessary pre-migration and post-migration tasks, you can successfully transfer your website to a new server. Always remember to take backups and double-check all the details to avoid any potential issues. With careful planning and execution, your WordPress website will be up and running smoothly on the new server in no time.