Error establishing a database connection after site migration

I’m getting an error establishing a database connection after migrating my multisite to a new domain and new folder on the server. I checked the table prefix and the database details and they all appear correct in wp-config.

  • Adam Czajczyk
    • Support Gorilla

    Hello Thebe

    I hope you're well today!

    I checked the database and it seems that while the migration was performed the domain name in the database was not properly updated. There's a tool to help you fix that without having an access to the site.

    1. Please access the database via phpMyAdmin, go to the "Export" tab and export entire database to the file, just to have a backup in case anything went wrong.

    2. Downlad this script:

    Follow the guide on that page to install it on your server. PLease note: it's a standalone script, not a WordPress plugin so please follow the steps given there to the point.

    3. Once you open the script page you'll get field for values to be replaced and a replacement value; put

    in the first one and

    in the second one (replacement).

    Then use the "dry run" feature and it would simulate changes. It would show you how many tables should be changed and which ones so you can preview those changes. If you use "live run" after that it will process the database and should update all the references to the old domain with the new one which should sort the problem out.

    Best regards,

  • Thebe
    • WPMU DEV Initiate

    Hi Adam,

    It finally worked, I actually decided to cancel the migration on the subdomain and opted to migrate to the main domain which is and all worked very well.
    Thanks a lot for your insight.

    Best regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.