Wordpress can't connect. is it me?
November 22, 2010 6:50 AM   Subscribe

Fairly savvy user of Wordpress stumped by the good 'ol "Error establishing a database connection" when installing a new wordpress setup.

Greetings.

We had Wordpress running on a Windows box with Apache 2.2, Php 5, & MySQL 5.1. Blog wasn't used in a while, and we had call to add a second different one. Alas nobody could remember the password to phpmyadmin or the php root admin pwd. (This particular server isn't getting a whole lot of traffic!) So we decided to uninstall MySQL, make sure all the data in Documents and Settings/all users/ was gone, and do a fresh re-install of MySQL since we didn't care about the old blog. All is right with the world, can get to phpmyadmin no problem.

Cannot install Wordpress now. Get the famous "error establishing a database connection."

We made sure that username hostname (localhost) are correct in install.php.

I had three other people in our IT group verify it, since those pwds are long and it is not outside the realm of possibility for mis-typing to arise.

We changed local host to numeric IP addy of this server. Didn't work.


We tried (seperately) using root userid and pwd. Nope.

We even created a small .php program to connect to, insert, and delete from a db on this new MySQL install to verify permissions are set correctly. it worked fine. We then copied and pasted same into install.php and the wordpress db. We made sure the wordpress db had exactly the same permissions as our test db. No dice.

In my Google reading some people have said to check the php.ini file, but I am not sure what could be wrong there. I've checked it and seems to be in order.

Desperation ensued, my reputation is crumbling. Any help form the Wordpress experts out there?
posted by xetere to Computers & Internet (9 answers total)
 
(Apache) Can you check the apache error logs? Maybe something is hitting mod_security or something?

(Wordpress) Are you SURE there's not a typo in your wp-settings file? Are you SURE there's only one wp-settings file? Are you sure you are editing the correct wp-settings file?

(Mysql) Are you sure the user permssions are correct? Are you sure that user can connect to localhost? (you can just connect using the command line mysql user/pass? -h localhost)
posted by Blake at 7:04 AM on November 22, 2010


I've never run WP on Windows, but in my experience with Windows stuff gets left in the registry all the time. I'd open regedit and search for anything Wordpress or MySQL related.
posted by COD at 7:23 AM on November 22, 2010


WordPress and your OS's version of MySQL may have different ideas about where the default socket for connecting to MySQL should be. Make sure the one in php.ini and MySQL.conf (or whatever it is) match.
posted by mhoye at 7:24 AM on November 22, 2010


Response by poster: Blake and mhoye, if that were the case then wouldn't I not be able to connect to phpmyadmin, or the test page I created? After all I copied the userid and pwd to the wp-settings file. If I were able to connect to localhost then I should for this _ I am thinking.

Never sure about anything re: permissions, and typos, but I asked three colleagues to check my work. Possible we're ALL missing the typo, but I don't think likely, especially since we can connect ising the same permissions, userid, and pwd to the same MySQL install (Different table tho - but still hard for me to believe that 4 people missed a typo or a permission)

Will doublecheck socket, and will definitely open regedit, thanks.
posted by xetere at 8:31 AM on November 22, 2010


>> if that were the case then wouldn't I not be able to connect to phpmyadmin

Yes, good point. SOMETHING must be different in the way WP is trying to connect. Did you try replacing wp-config with a new one and setting the user/pwd again?
What happens if you put random stuff at the top of wp-config, do you get a different error message?
posted by Blake at 9:22 AM on November 22, 2010


I'm a little unclear on your specific steps with the PHP file. Did you use your little PHP script to connect, insert, and delete from the database you created for Wordpress?

Because it is possible that the MySQL user you created does not have access to the Wordpress database. Or that the database name is misspelled or something.
posted by ErikaB at 12:35 PM on November 22, 2010


(Um, I didn't mean "your little PHP script" to sound demeaning, the way that it did, sorry! I meant "the script you created for testing purposes, as opposed to the big Wordpress scripts.")
posted by ErikaB at 12:36 PM on November 22, 2010


I've never run WP on Windows, but in my experience with Windows stuff gets left in the registry all the time. I'd open regedit and search for anything Wordpress or MySQL related.

Apache, php, mysql and for sure wordpress have nothing in the registry. It's all config files.
posted by sleslie at 1:14 PM on November 22, 2010


I was getting this error on one site until I set "localhost" to "localhost:/tmp/mysql5.sock" because of the settings of my host.
posted by RobotHero at 2:56 PM on November 22, 2010


« Older Ways to Brisket?   |   English to Sinhala translation Newer »
This thread is closed to new comments.