Step-by-Step Guide on Migrating Your WordPress Site

Solve WordPress site migration issues with tools like phpMyAdmin and WP Migrate for an effortless transition with no data loss or interruptions.


Step-by-Step Guide on Migrating Your WordPress Site Img

Table of Contents

    There are a couple of reasons why someone might migrate their WordPress website; they might have switched to a new host or migrated from a different CMS, for example. The migration process, however, does come with its own set of risks, like data loss, downtime, and negative SEO impacts. One of the steps in this process is often to import the database to the new WordPress site, which can be a critical and sometimes challenging part of the migration. 

    Proper planning and using the right tools can help, and in this step-by-step guide, we’ll give you instructions so you can confidently manage the migration process. We'll show you how it's done using popular tools like phpMyAdmin, WP CLI, and WP Migrate. Before we get started, though, we want to make something very clear: The risks associated with migrating your site shouldn’t be ignored, especially for mission-critical sites. We always recommend getting professional help from a WordPress agency like Multidots for the safest solution.

    Pre-Migration Checklist: Preparing for a Seamless Transition

    Backup Your Website

    Backing up your website – including files, databases, and plugins – ensures you have a complete copy of your site in case anything goes wrong during the process.

    To back up a WordPress site, you can use plugins like UpdraftPlus, which offers a user-friendly interface for creating complete backups. Alternatively, you can manually backup your site via your hosting provider’s file manager (i.e., cPanel) or an SFTP (i.e., FileZilla).

    Update WordPress Core, Themes, and Plugins

    If migrating from one WordPress site to another (e.g., changing hosting provider), it’s important to update WordPress core, themes, and plugins to the latest versions. This ensures compatibility with the new hosting environment and reduces the risk of issues arising during migration.

    Test updates on a staging site before applying them to your live site to make sure they do not break site functionality. This allows you to troubleshoot any issues in a safe environment.

    Steps for Successful WordPress Site Migration

    Step #1: Exporting the Old Database

    Using phpMyAdmin:

    1. Access phpMyAdmin through your hosting control panel.
    2. Choose the database you want to export from the list on the left.
    3. Click on the Export tab at the top of the page.
    4. Select the Quick method for a simple export and ensure the format is set to SQL.
    5. Click Go to download the SQL file to your computer.

    Using WP-CLI:

    Make sure WP-CLI is installed on your current hosting server, then: 

    1. Access your server using SSH (use the default terminal for MacOS and Linux or PuTTY for Windows).
    2. Move to your WordPress root directory using cd/path/to/wordpress.
    3. Run the command wp db export filename.sql. This will create an SQL file of your database in the specified location. Please note: You can change ‘filename’ to whatever name you would like, and you can also change its location on the server.
    4. (Optional) Download the SQL backup file to your local machine using  scp (secure copy) to download the file:
      scp username@your_server_ip:/path/to/your/wordpress/your_database_name.sql /local/path/to/save 
      Replace /local/path/to/save with the path where you want to save the file on your local machine.

    Step #2: Creating a New Database on WordPress

    Creating a new database on the new host is an essential initial step in the migration process. Ensuring database integrity and compatibility is crucial for a smooth transition and the continued functionality of your WordPress site.

    Many hosting providers automatically create the database during the setup process. However, if you wish to create the database manually, you can follow these steps.

    Before proceeding, check your hosting provider's account dashboard or welcome email for the database details, including the database name, username, password, and host information. These details are necessary for connecting your WordPress site to the new database.

    Many hosting providers automatically create the database during the setup process. If that's the case, then check your hosting account's dashboard or welcome email for the database details and skip this step. However, if your hosting provider doesn't handle this step for you or you simply want to tackle this step manually yourself, then follow these steps to set up a new MySQL database:

    1. Access the Hosting Control Panel: Log in to your hosting control panel (e.g., cPanel).
    2. Go to the MySQL Databases Section: Find and click on the MySQL Databases section.
    3. Create a New Database: Enter a name for your new database and click Create Database.
    4. Create a New User: Scroll to the MySQL Users section, enter a username and password, and click Create User.
    5. Assign User to Database: In the Add User to Database section, select the newly created user and database, and click Add. Grant the user all necessary privileges.

    Please note: Make sure the new database user has the required permissions to read, write, and execute operations on the database. Also you need to securely store the new database credentials (database name, username, password, host) as they will be needed for updating the wp-config.php file.

    Step #3: Importing Data into the New Database

    Using phpMyAdmin

    1. Access phpMyAdmin on the New Host: Log in to phpMyAdmin through your new hosting control panel.
    2. Select the Database: Choose the newly created database.
    3. Import the SQL File: Click the Import tab, select the SQL file exported from the old host, and click Go to upload the database.

    Using WP-CLI

    First, use scp to upload the SQL file to your new host:

    scp /path/to/your_database_name.sql username@new_server_ip:/path/to/wordpress/

    Replace /path/to/your_database_name.sql with the path to your SQL file on your local machine.

    Then, use the command wp db import /path/filename.sql to import the SQL file. Please note: This should be the same file name that you have used above.

    Step #4: Updating WordPress Configuration Files

    The wp-config.php file is essential for connecting WordPress to the database. You need to update it during migration to ensure that your WordPress site can communicate with the new database.

    The wp-config.php file is typically located in the root directory, which you can access via your host’s control panel or an SFTP. To update database credentials:

    1. Open the wp-config.php File: Use a text editor (e.g., Notepad++, Sublime Text) to open the wp-config.php file.
    2. Locate Database Credentials: Find the lines that define the database name, username, password, and host. They look like this:
    define('DB_NAME', 'your_database_name'); define('DB_USER', 'your_database_user'); define('DB_PASSWORD', 'your_database_password'); define('DB_HOST', 'your_database_host');
    1. Replace the old database credentials with the new ones provided by your new host. For example:
    define('DB_NAME', 'new_database_name'); define('DB_USER', 'new_database_user'); define('DB_PASSWORD', 'new_database_password'); define('DB_HOST', 'new_database_host');
    1. Save the changes in the text editor and upload it (replacing the old one) using an SFTP client or your hosting file manager.

    Once done, load your WordPress site in a web browser to make sure it connects to the new database without errors. If everything is configured correctly, your site should load as expected!

    Step #5: Transferring Files to the New Host

    Transferring all WordPress files, including core files, themes, plugins, and uploads, to the new host is crucial for maintaining the functionality and appearance of your site. This step means all your site’s elements are intact on the new platform.

    Using SFTP Clients to Transfer Site Files

    1. Connecting to the New Host: Use an SFTP client like FileZilla or Cyberduck to connect to the new host. Enter your server credentials (hostname, username, password, and port).
    2. Navigating to the Root Directory: Once connected, navigate to the root directory of your WordPress installation on the new host where the files will be stored.
    3. Uploading Files: Upload all the WordPress files from your old host to the new host. This includes the wp-content folder, which contains themes, plugins, and uploads.

    Configuring DNS to Point to the New Host for a Smooth Transition

    After migrating your WordPress site, updating the DNS (Domain Name System) is important to make your site live on the new server. DNS translates domain names into IP addresses, directing users to the correct server hosting your website. Updating DNS ensures that visitors access your site on the new server.

    Updating A Records:

    1. Access Your DNS Management Console: Log in to your domain registrar or DNS hosting provider (e.g., GoDaddy, Cloudflare).
    2. Locate the A Records: Find the section where the DNS records are managed, usually under DNS Settings or DNS Management.
    3. Update the A Records: Edit the existing A records to point to the new server’s IP address. Save the changes.
      • Example:
        • Old IP Address: 192.168.1.1
        • New IP Address: 203.0.113.0

    CNAME (Canonical Name) records are used to alias one domain name to another. If your site uses CNAME records, update them to point to the correct new host:

    • Find CNAME Records: Locate the CNAME records in your DNS settings.
    • Update the CNAME Records: Edit the CNAME records to reflect the new server information. Save the changes.

    MX (Mail Exchange) records direct email to the correct mail server:

    • Locate MX Records: Find the MX records in your DNS settings.
    • Update MX Records: Edit the MX records to point to the mail server associated with your new hosting provider, ensuring email functionality is maintained.

    DNS changes typically take 24-48 hours to propagate globally. During this time, some users may still be able to access the old server. Use tools like What’s My DNS to monitor the propagation status. Enter your domain name to see which IP address it resolves to worldwide.

    Updating DNS settings correctly is essential for ensuring that your website and email services remain functional and accessible after the migration to the new server.

    Importance of Thorough Post-Migration Testing

    Ensuring that all core functionalities of the site are working as expected is crucial after migration. 

    Test all plugins and themes to confirm they are functioning correctly post-migration. If you encounter any issues, try disabling and re-enabling plugins to resolve potential conflicts. You are also going to want to review the permalinks structure to ensure it remains consistent with the pre-migration setup, as this helps avoid broken links and maintain SEO integrity.

    Steps to Fix Permalinks:

    1. Access Permalinks Settings: Go to your WordPress dashboard and navigate to Settings → Permalinks.
    2. Re-save Settings: Click Save Changes without making any alterations. This action can often resolve common permalink issues.

    Test all internal links to ensure they are redirecting correctly. Use tools like Broken Link Checker to identify and fix any broken links that may have arisen during migration.

    From here, you need to make sure no tables or entries are missing from the database:

    • Using phpMyAdmin: Log in to phpMyAdmin, select your database, and review the table structure and data.
    • Using WP-CLI: Run wp db check to verify the integrity of the database.

    Verify that custom fields and user data have been imported correctly. Check custom post types, user roles, and other custom fields for accuracy. Then make sure that SEO plugins are configured correctly:

    • Check that meta tags, titles, and descriptions are intact and correctly set up.
    • Use tools like GTmetrix or Google PageSpeed Insights to identify any performance issues and optimize accordingly.

    Waiting for DNS to Propagate Before Finalizing the Migration

    DNS propagation can take anywhere from a few minutes to 48 hours, depending on the DNS provider and the type of changes made. This waiting period is essential to ensure that the DNS changes are updated globally, making your site accessible from the new server without any downtime. Once this is done, you can finalize the migration:

    1. Update URLs: Once DNS propagation is confirmed, update the site's URLs, social media links, and other external references to point to the new host.
    2. Ensure SSL Certificates: Verify that SSL certificates are correctly installed and configured on the new host to maintain site security.
    3. Final Testing: Conduct a final round of testing to verify that all functionalities are working correctly. Check for any broken links or performance issues and address them promptly.

    By waiting for DNS propagation to complete and conducting thorough final checks, you ensure a smooth transition to the new host with minimal disruption to your site's accessibility and functionality.

    Migrating from one WordPress Site to Another with WP Migrate

    WP Migrate is a popular plugin designed specifically for WordPress site migration. Its primary function is to simplify the process of moving a WordPress site from one server to another. For smaller, simpler sites, WP Migrate offers a straightforward and efficient solution. However, it’s important to note that WP Migrate only works for migrations between WordPress sites; it is not suitable for migrating from a different CMS. This makes it an ideal tool for WordPress-to-WordPress migrations.

    Step-by-Step Guide to Using WP Migrate

    Step 1. Installing and Activating the Plugin:

    • Go to your WordPress dashboard.
    • Plugins Add New.
    • Search for WP Migrate.
    • Click Install Now and then Activate.

    Step 2. Set up WP Migrate:

    • After activation, go to Tools WP Migrate.
    • Follow the on-screen setup instructions to configure the plugin settings.

    Step 3. Export your site:

    • Go to Tools WP Migrate in your WordPress dashboard.
    • Start Exporting:
      • Click on the Export tab.
      • Select the components you want to export, such as the database, files, and themes.
    • Optimize Export:
      • Exclude unnecessary files to streamline the export process.
      • Use the compression options to reduce the size of the export file.
    • Export the Data:
      • Click Export and download the generated export file to your computer.

    Step 4. Import to the new location:

    • Install WP Migrate on the New Site.
    • Go to Tools WP Migrate on the new site.
    • Start Importing:
      • Click on the Import tab.
      • Upload the exported file from the previous site.
    • Complete the Import:
      • Follow the prompts to import the database, files, and themes.
      • Ensure all components are correctly imported and verify that the site functions as expected.

    Common Issues and Troubleshooting Tips

    There are a couple of known problems that can arise during the migration process:

    Database Connection Errors:

    1. Check Database Credentials: Ensure that the database name, username, password, and host in your wp-config.php file are correct.
    2. Verify Database Host: Confirm that the database host is set correctly. Common values include 'localhost', an IP address, or a specific hostname provided by your hosting provider.
    3. Test Database Connection: Use tools like phpMyAdmin to test the database connection directly. If you can’t connect, there may be an issue with the database server or your credentials.

    File Size Limitations:

    1. Split SQL Files: If your SQL file is too large, use tools like SQL Dump Splitter to divide it into smaller chunks that can be uploaded individually.
    2. Increase Server Limits: Adjust the PHP settings on your server to increase file size limits. Modify the php.ini file with the following directives:
    upload_max_filesize = 128M post_max_size = 128M max_execution_time = 300

    Consider using WP-CLI for importing large databases, as it often handles large files more efficiently than web-based tools.

    Character Set Mismatches:

    1. Check Character Sets: Ensure that the character set and collation of your database tables match those of your export file. Common character sets include utf8 and utf8mb4.
    2. Convert Character Sets: If there is a mismatch, use tools like phpMyAdmin or WP-CLI to convert the character set of your database tables:
    ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    1. Update wp-config.php: Make sure your wp-config.php file specifies the correct character set:
    define('DB_CHARSET', 'utf8mb4');

    Migrate with Multidots

    Migrations can be tricky, and there is a lot potentially at stake if it all goes wrong. It's important to have a smooth transition when moving data to maintain its integrity, prevent any downtime, and keep the website running smoothly. 

    Multidots' skilled team helps reduce the chances of losing or corrupting data, giving you peace of mind throughout the migration. Our hands-on approach guarantees that all data is transferred accurately, and we conduct extensive testing afterward to make sure everything is working properly. We provide personalized migration services to meet the unique requirements of every client, making sure the switch is seamless and effective.

    If you’re looking to migrate your WordPress site with confidence and precision, get in touch with Multidots today to learn how we can help!

    Book Your Free WordPress Consultation!

    Schedule a consultation call and discuss your migration requirements.

    Contact Us
    Mayur Keshwani

    Author

    Mayur Keshwani

    Mayur is a Senior Project Manager at Multidots, where he orchestrates projects with finesse and precision. With a knack for navigating complex tasks, Mayur ensures seamless execution and delivery of projects. His dedication to fostering strong client relationships and leading dynamic teams underscores his commitment to excellence.

    Home > Blog > Step-by-Step Guide on Migrating Your WordPress Site