Error Establishing Database Connection

Status
Not open for further replies.

lylex10h

Active Member
Messages
982
Reaction score
71
Points
28
Unfortunately "Error Establishing Database Connection" is a very generic error. It tells you there is a problem, but not what the problem is, such as the Check Engine light in your car. So create a .php file with the following code:

PHP:
<?php

$link = @mysqli_connect('localhost', 'DB_USER', 'DB_PASSWORD');
if(!$link) {
    die('failed to connect to the server: ' . mysqli_connect_error());
}

if(!@mysqli_select_db($link, 'DB_NAME')) {
    die('failed to connect to the database: ' . mysqli_error($link));
}
?>

replace DB_USER, DB_PASSWORD and DB_NAME with the settings from from wp-config.php file. Reply with the output of that php file.
 

mcmmsagh

Member
Messages
51
Reaction score
0
Points
6
I believe that's the same case that's going on with my site, but more specifically the forums section of it. There, I ran into this error message which says:

The database connection failed. Please check your database configuration in (file name withheld). If the configuration is okay, check if the database server is running.

I still have a feeling this is something the hosting admins need to get address A.S.A.P.
 
Status
Not open for further replies.
Top