1

I have been trying to install WordPress, but I get the error, "Error establishing a database connection". I realize this is a common error, but after a few hours, I haven't found any solutions that work in my case.

I've tried uninstalling WordPress, phpMyAdmin, MySQL, and PHP, rebooting, and starting from scratch. I tried clean installing from tutorials for everything.

I am running Windows Server 2008 R2, fully updated, with IIS7.

Nothing can access MySQL, except the command line, and applications like HeidiSQL. phpMyAdmin cannot access it, either.

I tried installing WordPress first manually, using the "five-minute setup" method, and also using the Web Platform Installer setup. It said that it installed successfully (and the installer made a database, and a user/password for WordPress), however, when I opened the URL, it doesn't work and just gives me the error, "Error establishing a database connection."

I'm really lost as to what could be wrong. Since it can be accessed with applications/command line, but not through the browser, it seems like it could be a permissions issue, but I couldn't manage to fix it, though maybe I don't know all the directories it needs permissions for.

I am running PHP 5.3.20, MySQL 5.5, and WordPress 3.5.

2
  • Do you have any firewall?
    – Grumpy
    Dec 23, 2012 at 13:56
  • Where is your mysql installed, on the same machine where you are running wordpress or on a different machine ?
    – Napster_X
    Dec 27, 2012 at 8:12

2 Answers 2

2

You'll most probably get the error :

"Error establishing a database connection"

when the configuration is not correct. Check the config file. If you're sure that you've configured it properly then I assume there could be another active connection to the database.

If you need a Wordpress local sandbox environment you can use XAMPP tool which will configure Apache, Mysql, php and phpmyadmin for you. But make sure that the port 80 and 8080 is available. Or it is better to disable the ISS feature of windows and remove the Windows server.

After installing XAMPP, create database and try the "Famous five minute install" for Wordpress.

Hope this helps..

0

When you setup the database connection info for wordpress did you specify your computer LAN IP address or localhost (127.0.0.1)?

Given everything is running on the same host I would suggest using localhost anywhere you might be specifying your LAN IP address. Also I would check to make sure that MySQL is listening on both localhost IP as well as your computers LAN IP. You can do this using netstat.

image of netstat output

In the example above I'm listing out all the processes that are using a network connection. You're looking for processes that are listening on port 3306 (item #1 in my screenshot which is listening on port 80). The program that's associated with this port is item #2, TeamViewer in my example. Item #3 is the process ID of the running program, 1588.

You want to make sure that for item #1 the IP address reads either 0.0.0.0, you LAN IP, or localhost. It may read a combination of those or all three. The important thing is that the mysqld.exe program is listening on the IP address that you're using when you try and connect.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .