When attempting to convert WordPress to a Multisite setup, I get the error:
Error establishing a database connection
I\'m using
My DOMAIN_CURRENT_SITE in wp-config.php was define('DOMAIN_CURRENT_SITE', 'www.example.com');
Removing "http://" in wp_blogs -> domain fixed my issue.
Besides to all said above, if working with multisite environment please check also the following: in the respective subdirectories (/home/subsitename) there exist separate wp-config.php and .htaccess files for each of (sub)sites, so the above mentioned parameters have to be adjusted in all of these files. For example, my main site was working correctly since these files in my /home directory were OK, but when tried to access my sub-sites, I've been receiving database connection error message until I adjusted these files too.
I had the problem after moving the multisite from a sub directory to the root directory.
What solved it for me was partly what has been mentioned by Sabin Chirila :
but I had to change some more things.
Here's How I fixed it
config settings
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false );
define( 'DOMAIN_CURRENT_SITE', 'localhost' );
define( 'PATH_CURRENT_SITE', '/myblog/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );
then in the database table (found using phpmyadmin) wp_blogs set the values for your root blog (which should be lie/number 1) to
domain localhost
root /myblog/
And finally - reset the sitrurl and homepage in options table (again found using phpmyadmin) to
http://localhost/myblog/
Inspired by Sabin's answer, I checked wp_blogs
and found that the domain
value was still pointing to the wrong domain (I was moving a multi-site to a dev server). Running UPDATE wp_blogs SET domain='example.com';
fixed my issue (note that I'm using subfolder multisite, not subdomain - don't blindly run that SQL!)