When attempting to convert WordPress to a Multisite setup, I get the error:
Error establishing a database connection
I\'m using
I had a strange encounter very recently. After setting up a dev server which runs under a different domain and moving a multisite setup to it I got the same error “Error establishing a database connection”. I had checked that all the wp_options tables have the correct domains in the respective settings and that my database connection had the right credentials and would work under normal circumferences.
I found a way to get a better error reporting. I added an output of the database object in the function dead_db() in functions.php which then showed me that it couldn’t find any blogs for my site in the table wp_blogs. I simply forgot to update the domains for the test server in this table.
function dead_db() {
global $wpdb;
echo "";
print_r($wpdb);
echo "
";
wp_load_translations_early();
Hope that helps someone :)