Error when trying to restore website, database error


Im trying to restore my site.

I use a full backup from The Hub and that a new created website, with new and clean db.
The backup is from a .dk domain, and i running it on a .eu domain where i change the site URL.

At beginning it look like everything is fine, but then it stop at this:

And between 5-10 minutes i get following message:
Error establishing a database connection

Any idea why this happens?

Best regards,

  • Nastia

    Hello Mikkel , I hope you are doing well!

    Since the database is new, "Error establishing a database connection" means that the restored site can't connect to the database, the database name/password are different from the initial setup.

    Please edit the wp-config.php, locate and edit the following rules:

    // ** MySQL settings ** //
    /** MySQL database username */
    define('DB_USER', 'The_database_name');
    /** MySQL database password */
    define('DB_PASSWORD', 'The_database_password');

    Match the databse name and username with the new one that you've created.

    Let me know how it went!

    Kind regards,

  • Sajid

    Hello Mikkel,
    Hope you are doing good today :slight_smile:

    Do you restoring the site on a different WordPress site or on the same site ?

    Also, if its on the same site, then did you changed the DB prefix after that backup archive ? If yes then you have to switch the db prefix back to match with the backup archive and then restore it again.

    Here is a nice tutorial to do it on the current site:

    But before actually changing the DB prefix. Make sure you take backup of your current site first.

    You can find the old prefix in the full_backup zip archive. Download and extract the archive on your computer and check the name of any .sql file. In screenshot below, the prefix is wp_.

    Take care and have a nice day :slight_smile:

    Best Regards,
    Sajid - WPMU DEV Support

    • Mikkel

      Hi Sajid,

      I was able to restore the site now, but that was a normal restore, where i import the file.
      I used the same prefix, as in backup and i was able to open the site.

      But it seems to be something wrong with the restored site, im not able to do automatic backups with snapshot, i just get following error code:

      I have try to reset snapshot api key and this didn't make any change for me.

      Best regards,

    • Mikkel

      This is from my error log:

      [snapshot][2017-02-17 20:54:23][Info] Starting backup
      [snapshot][2017-02-17 20:54:24][Info] Created the backup and added the queues
      [Cron][2017-02-17 20:55:46][Info] Next start action scheduled for Sat, 18 Feb 2017 01:00:00 +0000
      [Remote][2017-02-17 20:55:46][Info] Use non-expired local token
      [Remote][2017-02-17 20:55:47][Info] Successful remote response for register-settings
      [Cron][2017-02-17 20:55:53][Info] Next start action scheduled for Fri, 17 Feb 2017 21:00:00 +0000
      [Remote][2017-02-17 20:55:53][Info] Use non-expired local token
      [Remote][2017-02-17 20:55:53][Info] Successful remote response for register-settings
      [Remote][2017-02-17 20:59:07][Info] Initiate token exchange
      [Remote][2017-02-17 20:59:08][Info] Successful remote response for get-urls
      [Remote][2017-02-17 20:59:08][Info] Successful remote response for get-token
      [Remote][2017-02-17 20:59:08][Info] Update token with remote response
      [Remote][2017-02-17 20:59:09][Info] Successful remote response for register-settings
      [Remote][2017-02-17 20:59:09][Info] Use non-expired local token
      [Remote][2017-02-17 20:59:11][Info] Successful remote response for credentials
      [snapshot][2017-02-17 20:59:15][Info] Starting backup
      [snapshot][2017-02-17 20:59:15][Info] Created the backup and added the queues


  • Nastia

    Hello Mikkel , hope all is well!

    I've tried to access your site, I am afraid the remote access is deactivated. Would you please revoke and re-grant access from your end?

    Based on the errors log there is nothing that indicated there has been an error. Please enable WordPress debugging and wait till the automatics backup will run agaian. Putting the following to the wp-config.php file:

    define( 'WP_DEBUG', true );
    define( 'WP_DEBUG_LOG', true );
    define( 'WP_DEBUG_DISPLAY', false );

    Make sure that you insert this line BEFORE /* That's all, stop editing! Happy blogging. */ in the wp-config.php file.

    Once yeh Automatic backup is finished, all errors will be saved in the debug.log file inside the /wp-content/ directory.

    Rename the debug.log to debug.txt and attach it here so we could have a look.

    Kind regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.