Strange error: Only mainsite database error, subsites working fine.

I just moved my multisite from one server to an other server. All the DNS settings are changed, and the sites are working fine. Expect the main site... There I get Error establishing a database connection.

I already tested the database connection with the PHP test file as WPbeginner suggested. The connection is working fine. All the subsites are up and running correctly. Only the mainsite gots the error.

I really have no clue at all what is happing here. How can the main site have a database error, while the others are working fine?

Thanks for the help!

  • Nithin
    • Support Wizard

    Hi Maarten,

    Hope you are doing good today. :slight_smile:

    That's odd, since it's only related to your mainsite, most of the time the Error establishing a database connection. relates to having a having incorrect DB details.

    Does your debug.log files indicate any error? Could you please enable debug mode, and check whether it helps in troubleshooting this issue.

    To enable it, open your wp-config.php file located in your root directory, and look for define(‘WP_DEBUG’, false);. Change it to:

    define('WP_DEBUG', true);

    In order to enable the error logging to a file on the server you need to add:

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

    Once you replicate the error, the related errors will be saved to a debug.log log file inside the /wp-content/ directory.

    Please attach these in your next reply in txt format file, so that we could give a closer look. You can find more details about debugging here.

    If your debug.log files, doesn't show any related error, or if it doesn't help much. Could you please send us your credentials, so that we could give a closer look.

    You can send credentials by using our secure contact form:

    Select "I have a different question" for your topic.

    - To Mark to my attention, the subject line should contain only: ATTN: Nithin Ramdas
    -WordPress admin username
    -WordPress admin password
    -login url
    -FTP credentials (host/username/password)
    -Cpanel, or DB creds
    -link back to this thread for reference
    -any other relevant urls

    Please let us know how that goes, have a nice weekend. :slight_smile:

    Kind Regards,

  • Ash
    • WordPress Hacker

    Hello Maarten

    This is usually database prefix issue, is the prefix changed after moving to new server? How did you move to new server?

    We will also need your plesk access, I can see you have provided username/password, but would you please send your plesk URL in the same way you did before?

    Have a good day!


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.