It is just saying that it isn’t able to make a connection to the database through wp-config.php file in your root directory of wordpress. Check that file over and make sure it has the correct information of your mySQL database and server. If you correct that, then maybe your host is having a mySQL server issue and I would maybe contact them.
Most often, it is just a small typo in wp-config.php that has the database information not what it needs to be or a password that was entered incorrectly.
Trent
This has been happening more and more frequently. It only seems to be my WordPress profile. IPB, SMF forums are not affected and also a moveable type blog are all on the same shared server using mySql.
Error is:
Error establishing a database connection
This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at localhost. This could mean your host’s database server is down
Not sure exactly what this means but other sites using mySql are working fine but with exception to one using wordpress.
Here is response from the server admin:
“I have checked the issue and the site is loading fine at the moment from my end. The issue is occurring because the max user connections has been attained on the server . Hence any further connection will be refused on the server . Please check the same from your end and let us know if you require any further assistance.”
After upgrading to 2.1, I’ve encountered the same message over and over again any time I try to login or access the blog at all. Everything else on the site works, except for the WordPress database. My host tells me everything is fine with my account, but they’re checking again.
Same thing is happening to my server after upgrading to 2.1. Anyone have any info?
I’m having this very same issue but with 1.5, suddenly after 1 years…
When I connect with phpmyadmin to the database it gives me this error when choosing “operations”
The additional Features for working with linked Tables have been
deactivated. To find out why click here.
Don’t know if it’s related…
Error establishing a database connection
This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at localhost.
I have 2 times had the same problem:
My solution was to change the wp-config.php in line 6
define(‘DB_HOST’, ‘localhost’); // 99% chance you won’t need to change this value
but I changed it to the name of my webhotel ex= webhotel4webhotel.com
That was all as the information told me.
Not really sure how this happens but this is what solved it for me.
I ran the following php to show how mysql was configured for php:
<?php
// Display a list of PHP?s compile-time features
phpinfo();
?>
Under the mysql section you’ll see the following showing that PHP is looking for the socket under a /var dir by default:
MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 4.1.22
MYSQL_MODULE_TYPE external
MYSQL_SOCKET /var/mysql/mysql.sock
MYSQL_INCLUDE -I/usr/include/mysql
MYSQL_LIBS -L/usr/lib/mysql -lmysqlclient
You can also run the following to try to make a db connection through PHP and it will show the connection error which points to it looking for the mysql.sock file in the wrong directory.
<?php
if ($cn = mysql_connect("<host>", "<username>", "<password>")) {
echo "connected";
} else {
echo "not connected - " . mysql_error();
}
?>
To solve this I edited the php.ini file for my server and changed:
mysql.default_socket =
to
mysql.default_socket = /tmp/mysql.sock
southerncyclone
Thanks for the great tips on troubleshooting this issue.
My server is a Windows 2003 Server running IIS, PHP version 4.4, MySQL 5.0 and WordPress 2.1 with dual proc and 4 GB.
My error message states that my MySQL client (3.23.49) doesn’t support the authentication protocol and I should upgrade MySQL.
Is your example using 5.1 beta? OR am I missing something else?
After searching, searching and searching, this is the only thing I have found that related to my problem. And it worked! Thanks.
I am using XP Pro/Sp2 (I had IIS5.1) Abyss Web Server, PHP 5.2.1, MySql 5 (both Came with Abyss). I still had the same problem with this setup as with ISS. “Error establishing a database connection” I use this server on my home computer for web development.
I fought this thing for two weeks. Somewhere there should be a notice in the downloads, etc., to Windows users about this. PHP was working fine for everything except WordPress. So even though it is a PHP.ini modification required, it is also a WordPress problem for Windows users. And as a plus, a logon script I was using that did not work is now working too.
Again Thank you!
I found that the mysql client in PHP was incompatible with MySQL 5.0 — the encryption used for passwords breaks. I’ve had this same problem with a couple other mysql connection drivers.
The fix is described here:
http://dev.mysql.com/doc/refman/5.0/en/old-client.html