Error establishing a database connection

Status
Not open for further replies.

ambitio6

New Member
Messages
1
Reaction score
0
Points
1
My site has been working fine. It's wordpress. I've been mostly using the site for fun and trying to learn about wordpress. I haven't changed anything, but it started loading really slow and then now says "Error establishing a database connection".

Any thoughts on what this could be?
 

lylex10h

Active Member
Messages
982
Reaction score
71
Points
28
Setup a .php file with the following code

PHP:
<?php

$link = @mysqli_connect('host', 'user', 'secret');
if(!$link) {
    die('failed to connect to the server: ' . mysqli_connect_error());
}

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

?>

Replace host, user, secret and dbname. I believe this should give you a raw error if it fails.
 
Status
Not open for further replies.
Top