Home | WordPress - Rails - Litespeed »
WordPress installation - Error establishing a database connection
By Nick | March 19, 2007
First post and first complaint. For all of you wondering why I am using a php blog, I would like to say that I looked first at Mephisto. But unfortunately I didn’t manage to get it running
So I thought I’ll try the market leader WordPress, that should be fairly easy to install. And yes, they have a five minute installation guide. Five more minutes and I’ll be blogging …
Not exactly! I got the error: Error establishing a database connection, even though I had everything configured fine in wp-config.php So after a lot of searching on the WordPress forum (a lot of people already had encountered this error!) I found the solution.
I added the following line to wp-db.php (in the wp-includes folder)
function wpdb($dbuser, $dbpassword, $dbname, $dbhost)
{
$this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword, true);
//Add this line:
echo (mysql_error());
This returned the error “Client does not support authentication protocol requested by server; consider upgrading MySQL client”
Since I’m already running MySQL 5 I didn’t see any point of upgrading it. So I continued my quest for a solution. And there it was …
WordPress apparently isn’t to keen on the new password structure of MySQL 5, so I had to run the following query to give my WordPress user an “old” password.
SET PASSWORD FOR some_user@some_host = OLD_PASSWORD('your_old password_here');
And as you may have noticed I have managed to get it running!! So stay tuned for some Rails gossip ![]()
Topics: Uncategorized |
April 17th, 2007 at 10:58 am
But Where I’ve to put the line : SET PASSWORD …….
April 17th, 2007 at 3:07 pm
@Roger. You should put the SET PASSWORD line in your MySQL console, either with the command line or with programs like SQLYog, MySQLFront, …. SET PASSWORD … is just a SQL command.
May 3rd, 2007 at 8:23 pm
I’ve been having the same issue as you had (with no help from Wordpress support).
Tried your method and still no go.
“SET PASSWORD FOR blog = OLD_PASSWORD(’blog485′);”
May 30th, 2007 at 10:13 pm
Very helpful, thank you. It is quite easy to fix a problem once you know what has actually failed. If I get my arse into gear I’ll submit a patch to WordPress that displays the underlying error along with the unhelpful error message.
January 24th, 2008 at 6:29 pm
GENIUS! - Thank you. You just ended a 2 day, painful experience.
February 13th, 2008 at 8:49 am
tried your solution and by damn, it worked!!!!, thanks! thanks! thanks!
wow, what a time and sweat saver you have been :-}
it is really appreciated!!!!!!!
March 6th, 2008 at 11:27 pm
Ok, I’m a newb, and I’m just learning how to deal with MySQL. I’m in the MySQLAdmin / phpMyAdmin page. And I don’t know where this MySQL Console is. I don’t know exactly where to write this piece of code. If you guys can help, I appreciate it greatly! Thanks.
March 13th, 2008 at 5:35 pm
Halle-frikin-lujah. I knew something wasn’t right with my connection either - whatever I tried I could not get any PHP page from my website (a Win server) to connect to MySQL. the exact same script ran fine under OSX on localhost… I finally tried a user without password and bingo - it works. But no password = no security. I tried your SET PASSWORD query and now my installation is secure again.
Thanks for posting this.
March 13th, 2008 at 5:37 pm
btw I am NOT running MySQL 5 - but some 4.something version…
August 27th, 2008 at 10:02 pm
Where do I put this code in? IN the wp-config.php file? or where?????
August 27th, 2008 at 10:15 pm
I did it! I did it!
Thank you so so so so so so so much!!!!!!!!
August 30th, 2008 at 6:09 pm
I don’t see the code,
function wpdb($dbuser, $dbpassword, $dbname, $dbhost)
{
$this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword, true);
that I can add,
//Add this line:
echo (mysql_error()),
this to.
November 10th, 2008 at 12:13 am
Thanks man your my hero!
November 13th, 2008 at 5:39 pm
Ahhhh my life was feeling consumed by this error…THANK YOU! O THANK YOU!
November 19th, 2008 at 11:12 am
thanks!! saved my no doubt another day of searching in the dark for the solution.
December 2nd, 2008 at 3:26 pm
Error establishing a database connection is resolved by changing localhost with hosting server database address in ixwebhosting