Wordpress throwing connection error on page

Status
Not open for further replies.

Stanley

Banned
Jun 24, 2006
3,399
43
0
San Diego
Not sure what's causing it but one of the pages is throwing a database connection error. What makes this strange is that all of the other pages open just fine without any problems.
Has anyone had this happen before? Or know how to diagnose it?

I'm running WP 2.6.2
 


"Error establishing a database connection"

I tried the wait_timeout hack but it didn't help.

I'm not that familiar with WP's internals. How would you debug these type of errors?
 
I've been getting a database error message also using Firefox, and a page full of nonsense instead of the web page. After sending in a trouble ticket to the hosting, this was the answer:

[FONT=arial, sans serif] I have tested your domain in both Internet Explorer and Firefox and your site was able to resolve without issue. If you are experiencing an issue with a slowness in your site, you may need to optimize your database for maximum loading speed. [/FONT]
 
I'm not that familiar with WP's internals. How would you debug these type of errors?

If it's a post query then it's handled by /wp-includes/query.php. Find this line:

Code:
$this->request = apply_filters('posts_request', $request);
and add in something like this afterwards:

Code:
echo "<!--". $this->request . print_r($wpdb,true) .    " -->\n";
which will let you look at the request and the database object.

You can also look at the database class itself in /wp-includes/wp-db.php. It could be this part that's printing out your error:

Code:
        $this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword, true);
        if (!$this->dbh) {
            $this->bail("
<h1>Error establishing a database connection</h1>
If so, echo out the values for $dbhost, $dbuser, $dbpassword to make sure they're correct.

Cheers,

Leon
 
Status
Not open for further replies.