Many times I saw this message. “Error establishing a database connection”. That time I did not understand why this message is coming.
When started working on WordPress blog Plugins, Themes. Then I got to know about this error.
Whenever you mis-configured the wp-config.php file. You will this kind of error.
You need to Fill following information correctly:(dont forget to create database your own)
** The name of the database for WordPress */
/** MySQL database username */
/** MySQL database password */
/** MySQL hostname */
This will solve your problem.