Support » Networking WordPress » Database error when enabling mutlisite

  • Resolved BSPBrent


    I’m trying to setup network blog support so I can host multiple blogs in one install using subdirectories. Everything seems to go smoothly, right up to the point when I enable network blog support and have to re-login in. Instead of a getting a login page, I get a page “Error establishing a database connection”.
    Obviously there is not issue connecting to the database, since the initial install went fine. If I try to go to the wp-admin directory, then I get an error “One or more database tables are unavailable”. I enabled repair and tried repairing, but that fails with error that the tables don’t exist (i.e. de_2_posts, de_2_comments, de_2_links,…).
    I’m tempted to create those tables manually to see what happens, but I shouldn’t have to.

    I can turn multisite support off and everything works fine as a single instance, so this is not a database connection issue. I do have control over the server, but I am not installing in the root directory. The install URL is blog/de/

    define(‘WP_ALLOW_MULTISITE’, true);
    define(‘MULTISITE’, true);
    define(‘SUBDOMAIN_INSTALL’, false);

Viewing 15 replies - 16 through 30 (of 32 total)
  • Moderator Ipstenu (Mika Epstein)


    Lead Plugin Wrangler

    barneygumble78 – Please make a NEW post. Your issue is not related to the topic at hand and it dilutes our ability to help anyone.

    To the people having this problem, did commenting out
    define('WP_ALLOW_REPAIR', true);
    have ANY effect?

    Already done but unsuccessful
    it says wp_<blogid>_<tablename> is missing
    I’m going to open a new post as suggested

    I started over with a clean code download. I did not have the WP_ALLOW_REPAIR setting in place and still had the same issue. I tried creating the tables manually, but still got the database connection error.

    My databases are set to have an auto increment increment of 3 for replication, but WordPress is looking for de_2… tables. But that is an interesting suggestion. I would certainly hope WordPress doesn’t have issues with increment values.

    I enabled the repair option and tried to “repair” the tables, but everything came back ok.

    The de_users table is okay.
    The de_usermeta table is okay.
    The de_2_posts table is okay.
    The de_2_comments table is okay.
    The de_2_links table is okay.
    The de_2_options table is okay.
    The de_2_postmeta table is okay.
    The de_2_terms table is okay.
    The de_2_term_taxonomy table is okay.
    The de_2_term_relationships table is okay.
    The de_2_commentmeta table is okay.
    The de_blogs table is okay.
    The de_signups table is okay.
    The de_site table is okay.
    The de_sitemeta table is okay.
    The de_registration_log table is okay.
    The de_blog_versions table is okay.

    Andrea Rennick


    Customer Care at Copyblogger Media and Studiopress

    I would certainly hope WordPress doesn’t have issues with increment values.

    It’s legacy code from multisite. It *does* expect an increment value of one.

    (I checked with a dev.)

    oh no. so does that mean I’m stuck!? Does anyone know where in the code I can check for this?

    What is the id value in the de_site table?

    And, what is the blog_id & site_id on the main site in the de_blogs table?

    Re: Andrea_r’s comment above, a 1 might be hardcoded somewhere. I haven’t had a chance to check yet. If there is I’ll create the ticket & patch.

    If your blog_id for your main site in de_blogs is 2, change it to 1 and your site should run fine.

    I’ll create the ticket in trac so we can discuss how to best handle the situation.

    Yes, the “id” in de_site is 2. For the database server it is on, the auto_increment_offset is set to 2, so that would be the starting increment id.

    In my case ,
    in the WP_site table I have only one line with my main site.
    with the id=2
    in the WP_blog table I have 3 lines
    my main site have id=2 path=/blogs/
    the first sub-directory blog have 12 path=/blogs/labeltice/
    and the second 22 path=/blogs/licpro/
    (because of an auto-increment of 10 with my mysql server)

    Perhaps link with this problem, I have not the list of all my blolgs in the super admin menu, Only my main site appears.

    (NB my main site was install in a subdirectory not on the root directory)

    To fix your site, try what I suggested in my previous post.

    If your blog_id for your main site in de_blogs is 2, change it to 1 and your site should run fine.

    I make some experimentations…
    First I try what you suggested : put blog_id=1 to my main site (in the WP_blog table).
    It’s continue to go fine (I can post on my blogs and so on)
    but I still not have a complete list of my blogs in the super admin menu.

    So, I saw that my main site (blog) have a site_id = 2 (in the WP_blog table) and all the other have a site_id=1… hummm
    I change the “site_id” with 2 for all and they appear in the menu ! yes!

    To make it as clean as possible, I finally change all site_id to 1 in the WP_blog table and the id of my main site to 1 in the WP_site table.
    In this way I can had new blog without any intervention in the WP_blog table.

    Thx to your help

    I got the network blog install to work by changing the blog_id in the de_blogs table to 2. However, I also needed to change the SITE_ID_CURRENT_SITE constant in wp-config.php to 2, since that is the starting ID.

    Would changing the BLOG_ID_CURRENT_SITE constant to 2 have worked also instead of updating the database? That seems more of a straightforward solution to work around this “feature”. Not that it’s hard to update the database.

    Andrea Rennick


    Customer Care at Copyblogger Media and Studiopress

    the problem is the site reference in the db is not the same as the site referred to in the backend.

    changing site_id to 2 basically tells it there’s a second *network* in the install.

    This is my current wp-config.php for the site and blog IDs.

    define( ‘SITE_ID_CURRENT_SITE’, 2 );
    define( ‘BLOG_ID_CURRENT_SITE’, 1 );

    I had tried setting the site_id in all the tables to 1, along with the blog_id, but I still got the database connection error. I dropped all the tables and started over, setting the SITE_ID_CURRENT_SITE to 2. Now everything seems to be working. So the SITE_ID_CURRENT_SITE may need to be changed to what is in the database in addition to the blog_id change.

    Everything seems to be working now. Thanks for everyone’s help!

Viewing 15 replies - 16 through 30 (of 32 total)
  • The topic ‘Database error when enabling mutlisite’ is closed to new replies.