Support » Networking WordPress » Enabled multisite, lost database connection

  • Resolved inge12


    I successfully moved a blog from a blog subdirectory to the root. Everything was working fine.

    Then I followed instructions for enabling multisite, but did nothing else.

    I inserted the following code into config.php

    // ** Multi-site settings ** //
    define ('WP_ALLOW_MULTISITE',true);
    define( 'MULTISITE', true );
    define( 'SUBDOMAIN_INSTALL', false );
    $base = '/';
    define( 'DOMAIN_CURRENT_SITE', '' );
    define( 'PATH_CURRENT_SITE', '/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );

    My .htaccess file looks like this:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [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).*) $1 [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]
    # END WordPress

    Now I get an “Error Establishing Database Connection” message.

    I checked that the database has the correct tables. It does.

    I “repaired” the database. (It didn’t need it.)

    How can I re-connect the blog to the database without going back to single-site settings? (It works fine as a single site as soon as I remove the extra code)

Viewing 3 replies - 1 through 3 (of 3 total)
  • I manually checked the database and found that in the table wn_blogs there was an entry for the (sub)domain — perhaps from before I moved the blog to the root directory.
    I crossed my fingers and edited this to read ‘,” and my dashboard, etc., as well as the site came back up.
    It looks okay.

    Andrea Rennick


    Customer Care at Copyblogger Media and Studiopress

    Yeah, you;re okay. It throws up that db connection error when it can’t actually find the blog.

    I couldn’t figure out why it couldn’t find the blog, because all t he tables looked fine, until I looked at actual entries.

    Things are working okay, but I’m beginning to think I’d rather not have too may sub-sites on this particular project. The current WordPress works just great for multiple authors, with queries pulling up archives for each one.

    Otoh, it will save me some time on several of my personal sites.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Enabled multisite, lost database connection’ is closed to new replies.