Support » Networking WordPress » WP network problem "Error establishing a database connection"

  • Resolved sherpabizdev

    (@sherpabizdev)


    After running WP 3.1.3 for just a few weeks on a new site, I decided to activate the “network” settings. I am using subdomains and am hosting at Hostgator. All seemed to go fine. I can still access my original site at http://99andunder.com. I can also use the network admin features to create a new site (seemingly) successfully.

    However, the new subdomain site (such as sf2.99andunder.com) is inaccessible. I get the error in my browser “Error establishing a database connection.” I have read a few other related threads and tried disabling all plugins before creating a new site, but still the same error. Am not a database expert, so I have not mucked w/MySQL settings.

    Any advice? I am happy to post whatever config or file information is needed. Thanks in advance.

Viewing 15 replies - 1 through 15 (of 16 total)
  • Andrea Rennick

    (@andrea_r)

    Customer Care at Copyblogger Media and Studiopress

    Subdomains work on thepremise that wildcard subdomains are set up server side. Did you do those steps?

    Did you heck to see if the db tables for each new site were created in the db?

    Did you use a One-click installer to install wordpress?

    Hi Andrea_r,

    Thank you so much for the reply! Yes, I did setup the wildcard subdomain. And yes, I did use a one-click installer for WordPress. As for the db tables, I am not sure what to look for. Should there be a whole new db for each new site?

    Andy

    Andrea Rennick

    (@andrea_r)

    Customer Care at Copyblogger Media and Studiopress

    No, it adds a number of tables to the existing database. Usually one click installers change db permissions slightly and do not allow for the creation of new tables.

    If its just a site you’re re-doing, you could set it up with a new db manually.

    If not, ask your host to fix it.

    I’ve been getting the following information when I try to repair my database:

    wp_users: Table ‘presbyt1_wrdp1.wp_users’ doesn’t exist
    wp_usermeta: Table ‘presbyt1_wrdp1.wp_usermeta’ doesn’t exist
    wp_posts: Table ‘presbyt1_wrdp1.wp_posts’ doesn’t exist
    wp_postmeta: Table ‘presbyt1_wrdp1.wp_postmeta’ doesn’t exist
    wp_terms: Table ‘presbyt1_wrdp1.wp_terms’ doesn’t exist
    wp_term_taxonomy: Table ‘presbyt1_wrdp1.wp_term_taxonomy’ doesn’t exist
    wp_term_relationships: Table ‘presbyt1_wrdp1.wp_term_relationships’ doesn’t exist

    is there any way to create these tables again?

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Halfelf Rogue & Plugin Review Team Rep

    denniss – Different problem. You should make your own topic (and call your host to ask for a backup of your DB!)

    Just realized that. Reposted. Thanks.

    I checked my db and there is a ‘wp_blogs’ table that includes entries for the primary site and the subdomains I have created. Does the fact that the table and those entries exist indicate that db permissions is not my problem?

    O.k. I went to Hostgator support for help, and here is what they had to say. Not sure what to do with this information:

    Hello,
    I looked into this; however, it appears that the script is not creating the proper tables to correspond with new users. Errors that wordpress said should be provided for support are as follows:
    wp_4_posts: Table ‘sherpa_wdps1.wp_4_posts’ doesn’t exist
    wp_4_comments: Table ‘sherpa_wdps1.wp_4_comments’ doesn’t exist
    wp_4_links: Table ‘sherpa_wdps1.wp_4_links’ doesn’t exist
    wp_4_options: Table ‘sherpa_wdps1.wp_4_options’ doesn’t exist
    wp_4_postmeta: Table ‘sherpa_wdps1.wp_4_postmeta’ doesn’t exist
    wp_4_terms: Table ‘sherpa_wdps1.wp_4_terms’ doesn’t exist
    wp_4_term_taxonomy: Table ‘sherpa_wdps1.wp_4_term_taxonomy’ doesn’t exist
    wp_4_term_relationships: Table ‘sherpa_wdps1.wp_4_term_relationships’ doesn’t exist
    wp_4_commentmeta: Table ‘sherpa_wdps1.wp_4_commentmeta’ doesn’t exist

    That table prefix is not mentioned in any of your files; so I can only assume that it’s pulling the referrer’s id and attempting to access those tables. This would indicate a scripting error.

    I hope this helps with finding a resolution! Let us know if you need any server side adjustments.

    Any insights are welcome. Thanks in advance.

    Regards,

    Andy

    Andrea Rennick

    (@andrea_r)

    Customer Care at Copyblogger Media and Studiopress

    That table prefix is not mentioned in any of your files; so I can only assume that it’s pulling the referrer’s id and attempting to access those tables. This would indicate a scripting error.

    This answer indicates to be the support person does not realize how multisite works.

    It’s not a scripting error. Every new blog that gets created adds new tables to the db, with wp_*_whatever, and the numbers increase incrementally by 1.

    Feel free to forward this link to explain it to them:
    http://codex.wordpress.org/Database_Description

    If the db user does not have permissions to create new users, then yes it will fail. If they have the dbs set to increment in a value other than 1 it will also fail.

    Does the fact that the table and those entries exist indicate that db permissions is not my problem?

    No, because it added fields to an existing table. To add the new blogs it has to add a number of new tables to the db.

    Andrea_r, you’ve been amazing. I feel like I am getting close, but just don’t understand enough to fix this myself. Are you for hire? Should I just uninstall everything and start over?

    Here is the new reply I got after communicating the issues you presented:

    Hello,
    It still appears to be a scripting issue.

    mysql> select blog_id, site_id, domain from wp_blogs;

    +———+———+———————-+
    | blog_id | site_id | domain |
    +———+———+———————-+
    | 1 | 1 | 99andunder.com |
    | 4 | 1 | sfbay.99andunder.com |
    | 5 | 1 | sf2.99andunder.com |
    | 6 | 1 | test.99andunder.com |
    +———+———+———————-+

    This is information from one table. The following I found on the link your provided for multisite. The script is not creating the necessary tables. Above I’ve shown you
    “The data of the main site are stored in existing unnumbered tables. The data of additional sites are stored in new numbered tables.”

    mysql> show tables;
    +————————+
    | Tables_in_sherpa_wdps1 |
    +————————+
    | wp_blog_versions |
    | wp_blogs |
    | wp_commentmeta |
    | wp_comments |
    | wp_links |
    | wp_options |
    | wp_postmeta |
    | wp_posts |
    | wp_registration_log |
    | wp_signups |
    | wp_site |
    | wp_sitemeta |
    | wp_term_relationships |
    | wp_term_taxonomy |
    | wp_terms |
    | wp_usermeta |
    | wp_users |
    | wp_woo_term_meta |
    +————————+

    I added a new database user to the database to ensure that you have all database privileges available:
    ALTER CREATE CREATE ROUTINE CREATE TEMPORARY TABLES CREATE VIEW DELETEDROP EXECUTE INDEX INSERT LOCK TABLES REFERENCES SELECT TRIGGER UPDATE

    Andrea Rennick

    (@andrea_r)

    Customer Care at Copyblogger Media and Studiopress

    The script is not creating the necessary tables.

    … because somehow their server is blocking it… argh. If it was an issue with WP, this forum would explode.

    Did you use a one-click install for this? because THAT is the issue.

    If you’re willing to try it again, set up a new wordpress install manually. not with fantastico or any one-click installers.

    Yes, I did use a one-click install. O.k., I will give that a try. The directions don’t look too scary. I’ll post again after. Thanks so much for your help!!

    Andrea Rennick

    (@andrea_r)

    Customer Care at Copyblogger Media and Studiopress

    And when that works go tell HG support the db user to setup the one click installs will not allow WP to add new tables thereafter.

    Strange. Whatever the support person did must have resolved something. The subdomains I had previously tried still had the “error establishing database…” error.

    For the heck of it, I tried establishing a new site and it worked… and the site is reachable.

    Now I want to create a fresh one using a subdomain name I had already attempted before. The network admin panel did NOT show those old sites among the existing network sites. So I tried to re-create it new and I got an error that the site already existed. So I went into the wp_blogs table and deleted the old entries.

    I still can’t create a new site under the subdomain I want. The error I get now is “Sorry, that site is reserved!”

    Any thoughts about where else I need to clean out that name so that I can create a fresh site?

    Thanks in advance.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Halfelf Rogue & Plugin Review Team Rep

    I still can’t create a new site under the subdomain I want. The error I get now is “Sorry, that site is reserved!”

    What blog name are you trying to add? ‘blog’ won’t work.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘WP network problem "Error establishing a database connection"’ is closed to new replies.