I searched the interwebs and the solutions I found are mostly solving a different problem. To be specific, the problem being solved is about the WordPress MU migrated to WordPress MultiSite. Another problem raised that gets this message is about plugins incompatible with the MultiSite. Of course, you only need to disable those plugins.
Here's the case I have.
Type : VPS
WebServer : nginx-0.8.51
WP Version : WP 3.0.1 multisite enabled
Plugins Installed : NONE
Problem Description :
After adding new blogs on my multisite installation, the error 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.'
Additional Detail : The main site is accessible without any problem. The admin dashboard is configurable. So the message that there's a problem with the login credentials is simply not true.
It's one of those "too simple why I did not think about that" cases. I had to change the ownership of the wp-content folder to the nginx user.
chown -R nginx:nginx /var/www/domain.com/wp-content
Viola! The problem is solved. The issue here is that when you create a new blog and your webserver (in my case, nginx) cannot write into the wp-content folder (specifically on blogs.dir), WordPress does not throw the correct error message leaving you cold in the dark. I'm not sure if there's already a bug reported for this. But anyhow, I'll try to figure out how to report a bug.
If in case you don't want the webserver user(i.e, nginxuser) to own the folder, you can at least add nginxuser to the group that owns the folder and make the folder group writable (664 or 775).
usermod -G usergroup nginxuser
chmod -R 664 /var/www/domain.com/wp-content