NameSilo

WordPress Help Needed

Spaceship Spaceship
Watch

dan_Vt

Established Member
Impact
13
All of a sudden one of my WordPress blogs (http://www.movienarc.com) is down and I'm getting the below:

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.

* Are you sure you have the correct username and password?
* Are you sure that you have typed the correct hostname?
* Are you sure that the database server is running?

If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.

I don't think it's a server thing since my other WordPress installations are fine. I've made no changes since it was working last (didn't touch the wp-config.php file). I noticed that the user somehow had been deleted when I went into MySQL, but I have recreated the user and applied it to the database.

Can anyone help? I've never had a response to any of my questions at the WordPress support area, so I thought I'd try here.

Thanks for any assistance.
Dan
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
I seem to recall there being a flag you can set in your config on WP to turn off that page and get real errors from the PHP processor. I'd try that...it will tell you what's going on thats causing WP to throw up the error page.
 
0
•••
monaco said:
I seem to recall there being a flag you can set in your config on WP to turn off that page and get real errors from the PHP processor. I'd try that...it will tell you what's going on thats causing WP to throw up the error page.

I can't log in...how can I get to the flag?
 
0
•••
If i remember correctly, via editing the wp-config.php file. Lemme poke around my site (I'm running 2.0.3) and see if I can't be of more help.

Ok, in wp-includes/wp-db.php is where the strange errors are generated. If you tinker in there a bit you can easily get it to display raw errors.

The easiest would be to open up the bail() function in the file and call
Code:
echo mysql_error();
 
0
•••
monaco said:
If i remember correctly, via editing the wp-config.php file. Lemme poke around my site (I'm running 2.0.3) and see if I can't be of more help.

Ok, in wp-includes/wp-db.php is where the strange errors are generated. If you tinker in there a bit you can easily get it to display raw errors.

The easiest would be to open up the bail() function in the file and call
Code:
echo mysql_error();

So do I replace:
Code:
$this->bail("
<h1>Error establishing a database connection</h1>
<p>This either means that the username and password information in your <code>wp-config.php</code> file is incorrect or we can't contact the database server at <code>$dbhost</code>. This could mean your host's database server is down.</p>
<ul>
	<li>Are you sure you have the correct username and password?</li>
	<li>Are you sure that you have typed the correct hostname?</li>
	<li>Are you sure that the database server is running?</li>
</ul>
<p>If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the <a href='http://wordpress.org/support/'>WordPress Support Forums</a>.</p>
");

with:
Code:
$this->bail(echo mysql_error(););

I'm not very familiar with PHP, so I don't want to just mess it all up.

Thanks for the help.
D
 
0
•••
This is probably easier. Just make it look like this:
Code:
echo mysql_error();
$this->bail("whatever was originally in here");

This will print the mysql error then print the wp pretty error page. Just make sure you remove the mysql_error line (or comment it out) when you fix it to avoid revealing any data to the client on failure.
 
1
•••
Ok, now the error I'm getting is:

Access denied for user 'movienar_wrdp1'@'localhost' (using password: YES)
Warning: Cannot modify header information - headers already sent by (output started at /home/movienar/public_html/wp-includes/wp-db.php:45) in /home/movienar/public_html/wp-includes/wp-db.php on line 309

Any idea how to fix that? Looks like a user thing, but I set the user back up.

I have to leave shortly for a graduation, but thanks for the help and if you have suggestions let me know.

Rep added.

Dan
 
0
•••
Anyone else have ideas on how to fix this?
 
0
•••
repair mysql db
 
0
•••
all i can suggest is that, are you sure your username/password is right?
or are you conncting to the right database?
 
0
•••
Try creating a user that can connect from anywhere and see if it works. If it does, there's something funky going on with local name resolution or the connection is going over the wrong adapter.

Another thought...when ya recreated the user, did u remember to flush privileges?
 
0
•••
wackyjoe said:
all i can suggest is that, are you sure your username/password is right?
or are you conncting to the right database?

I'm pretty sure I have it right, and I've tried others that I've used before.

Is there any way by going into phpmyadmin to see what the password should be?

monaco said:
Try creating a user that can connect from anywhere and see if it works.

I don't know how to do that.

monaco said:
Another thought...when ya recreated the user, did u remember to flush privileges?

I completely deleted the user and recreated it with all privileges.
 
0
•••
To create a new user that can connect from anywhere, use the following syntax:
Code:
grant all privileges on databasename.* to 'username'@'%' identified by thepassword;
flush privileges;

The flush privs is extremely important, as it causes the mysqld process to re-load the auth information. If you don't do this, then the server won't recognize the changes until it's reloaded (or someone else flushes the privs for that process).

Unless you're using some weird plaintext password scheme for mysql, no. THe passwords are stored as hashes only to prevent an adversary from doing exactly what you described.
 
0
•••
monaco said:
To create a new user that can connect from anywhere, use the following syntax:
Code:
grant all privileges on databasename.* to 'username'@'%' identified by thepassword;
flush privileges;

The flush privs is extremely important, as it causes the mysqld process to re-load the auth information. If you don't do this, then the server won't recognize the changes until it's reloaded (or someone else flushes the privs for that process).

Unless you're using some weird plaintext password scheme for mysql, no. THe passwords are stored as hashes only to prevent an adversary from doing exactly what you described.

How do I flush privs? I'm not familiar with php and mysql, so if you know of a detailed walk-through that'd help.

thanks again,
Dan
 
0
•••
The second line in the code block above flushes the privileges.
 
0
•••
monaco said:
The second line in the code block above flushes the privileges.

Where do I put the code?
 
0
•••
At the mysql prompt. It gets executed like any other sql statement.
 
0
•••
I get the following error when I do that:

#1044 - Access denied for user 'movienar'@'localhost' to database 'movienar_wrdp1'

I've tried variations...but I don't know sql, so I feel like I'm wasting your time.

What would happen if I exported the database, uninstalled the script, reinstalled it and imported the data?

Well, I just did the above (exported data, uninstalled/reinstalled, and imported the data) seemed *knocking on wood* to go off without a hitch. Everything looks like it's working.

Thanks a lot for your continued help though.

More rep added.

Dan
 
0
•••
Glad I could help.

I can only imagine what weirdness your mysql install was goin thru back there, but it's fixed (unless I misunderstood) so I'd just chalk it up to Murphy's law, or sunspots, or something to that effect :)
 
0
•••
Appraise.net
Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back