Title: &quot;Error establishing a database connection&quot; when enabling multisite
Last modified: September 1, 2016

---

# "Error establishing a database connection" when enabling multisite

 *  [notch-1](https://wordpress.org/support/users/notch-1/)
 * (@notch-1)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-when-enabling-multisite/)
 * Hi,
    i have this strange issue: I enabled the multisite and everything was working
   fine, then i had to revert back to a backup taken just before enabling it (by
   the plesk panel), and now if i try to enable it again following the same steps,
   i get the database connection error. It’s a subdirectory install, and if i go
   to mysite.com/wordpress it works fine, but i can’t get rid of the error when 
   on mysite.com. Before enabling the multisite the site was up for few months, 
   giving no problems when accessing it from mysite.com.
 * The second time i enabled the multisite it skipped the part where asks for the
   network name and other things, i think the restore of the backup didn’t erased
   this informations, and god knows what else…
 * The exact moment when it brokes it’s when i paste the provided lines in the wp-
   config.php and .htaccess files and click on “login”.
 * suggestions on where to investigate?
 * here is my .htaccess (in the root dir):
 *     ```
       # BEGIN WordPress
       <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteBase /
       RewriteRule ^index\.php$ - [L]
   
       # add a trailing slash to /wp-admin
       RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
   
       RewriteCond %{REQUEST_FILENAME} -f [OR]
       RewriteCond %{REQUEST_FILENAME} -d
       RewriteRule ^ - [L]
       RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) wordpress/$2 [L]
       RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ wordpress/$2 [L]
       RewriteRule . index.php [L]
       </IfModule>
   
       # END WordPress
       ```
   
 * wp-config.php(just the relevant part, after the db connection configuration, 
   which is 100% correct):
 *     ```
       define('WP_DEBUG', false);
   
       define('WP_HOME','http://mysite.com/wordpress');
       define('WP_SITEURL','http://mysite.com/');
   
       define( 'WP_ALLOW_MULTISITE', true );
   
       define('MULTISITE', true);
       define('SUBDOMAIN_INSTALL', false);
       define('DOMAIN_CURRENT_SITE', 'mysite.com');
       define('PATH_CURRENT_SITE', '/');
       define('SITE_ID_CURRENT_SITE', 1);
       define('BLOG_ID_CURRENT_SITE', 1);
   
       /* That's all, stop editing! Happy blogging. */
   
       /** Absolute path to the WordPress directory. */
       if ( !defined('ABSPATH') )
       	define('ABSPATH', dirname(__FILE__) . '/');
   
       /** Sets up WordPress vars and included files. */
       require_once(ABSPATH . 'wp-settings.php');
   
       define ('FS_METHOD', 'direct');
   
       //--- disable auto upgrade
       define( 'AUTOMATIC_UPDATER_DISABLED', true );
       ```
   
 * index.php (in the root dir):
 *     ```
       <?php
       /**
        * Front to the WordPress application. This file doesn't do anything, but loads
        * wp-blog-header.php which does and tells WordPress to load the theme.
        *
        * @package WordPress
        */
   
       /**
        * Tells WordPress to load the WordPress theme and output it.
        *
        * @var bool
        */
       define('WP_USE_THEMES', true);
   
       /** Loads the WordPress Environment and Template */
       require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );
       ```
   
 * and this are the first lines of functions.php:
 *     ```
       <?php
       update_option('siteurl','http://mysite.com/');
       update_option('home','http://mysite.com/wordpress');
       ```
   

The topic ‘"Error establishing a database connection" when enabling multisite’ is
closed to new replies.

## Tags

 * [database connection error](https://wordpress.org/support/topic-tag/database-connection-error/)
 * [multisite](https://wordpress.org/support/topic-tag/multisite/)
 * [Plesk](https://wordpress.org/support/topic-tag/plesk/)
 * [subdirectory install](https://wordpress.org/support/topic-tag/subdirectory-install/)

 * In: [Networking WordPress](https://wordpress.org/support/forum/multisite/)
 * 0 replies
 * 1 participant
 * Last reply from: [notch-1](https://wordpress.org/support/users/notch-1/)
 * Last activity: [9 years, 11 months ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-when-enabling-multisite/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
