• So, when I set up the multisite I stupidly set the main site to “www.danoyes.com”

    We were experiencing some redirect issues when people typed in danoyes.com so we decided to change the main site URL to simply danoyes.com

    I did a database find all and replace.
    wp-config:
    define(‘DOMAIN_CURRENT_SITE’, ‘danoyes.com’);
    define(‘WP_HOME’,’https://danoyes.com’);
    define(‘WP_SITEURL’,’https://danoyes.com’);

    functions.php:
    update_option( ‘siteurl’, ‘https://danoyes.com’ );
    update_option( ‘home’, ‘https://danoyes.com’ );

    The weird thing is my site works just fine, but I can’t access wp-admin. When I try to access wp-admin it says “error establishing database connection”

    I’ve already ran “repair database” with no success.

    Thoughts?

Viewing 9 replies - 1 through 9 (of 9 total)
  • > We were experiencing some redirect issues when people typed in danoyes.com so we decided to change the main site URL to simply danoyes.com

    That could have been fixed with an additional rule in .htaccess redirecting danoyes.com to https://www.danoyes.com

    > I did a database find all and replace.

    I believe between the database replace and wp-config.php, that should have worked.

    > define(‘WP_HOME’,’https://danoyes.com’);
    > define(‘WP_SITEURL’,’https://danoyes.com’);
    >
    > functions.php:
    > update_option( ‘siteurl’, ‘https://danoyes.com’ );
    > update_option( ‘home’, ‘https://danoyes.com’ );

    These settings dont make sense to me. Why are you forcing them? Which WP multisite do you have sub-domain or sub-directory? I definitely wouldnt have those update_options settings in functions.php.

    Thread Starter zakkates

    (@zakkates)

    sub-directory set up.

    I replaced everything in the database first. Again, the sites work just fine (danoyes.com, mancusi.danoyes.com, lions.danoyes.com). The problem is when I try to access wp-admin it gives me the “Error establishing database connection” warning.

    I tried forcing things as an attempt to fix it. I was just listing out the things I’ve tried up to this point.

    I’ve tried:
    wp-config:
    define(‘DOMAIN_CURRENT_SITE’, ‘danoyes.com’);
    define(‘WP_HOME’,’https://danoyes.com’);
    define(‘WP_SITEURL’,’https://danoyes.com’);

    functions.php:
    update_option( ‘siteurl’, ‘https://danoyes.com’ );
    update_option( ‘home’, ‘https://danoyes.com’ );

    “repair database” with no success.

    error message: https://www.simple-edge.com/wp-content/uploads/2016/05/Screen-Shot-2016-05-11-at-2.13.27-PM.png

    I copy my production site to a test site often. All I did was dump my production database, search/replace https://www.prod.com with https://www.test.com, then updated the wp-config.php (database settings and DOMAIN_CURRENT_SITE only).

    Have you tried removing those settings? Will WP still work?

    wp-config:
    define('DOMAIN_CURRENT_SITE', 'danoyes.com');
    define('WP_HOME','https://danoyes.com');
    define('WP_SITEURL','https://danoyes.com');
    
    functions.php:
    update_option( 'siteurl', 'https://danoyes.com' );
    update_option( 'home', 'https://danoyes.com' );
    Thread Starter zakkates

    (@zakkates)

    Yes. I have removed it from both the wp-config.php and the functions.php. The only thing that remains is the domain_current_site

    The thing is, is that I didn’t migrate the site. I converted my multisite from https://www.danoyes.com to danoyes.com

    I did this by finding all “www.danoyes.com” and replacing it with “danoyes.com”

    The site (all pages and content) still work, including sub-domain microsites. However, I can not access wp-admin anymore, it insists that there’s an error establishing a database connection (which, seems false).

    <img src="https://www.simple-edge.com/wp-content/uploads/2016/05/Screen-Shot-2016-05-11-at-2.13.27-PM.png" style="display: block; width: 100%; height: auto; margin: 0 auto; " />

    > The thing is, is that I didn’t migrate the site. I converted my multisite from https://www.danoyes.com to danoyes.com

    migrate = convert. You should have followed the same procedure as me. My test system is an exact replica of my production, but using a different url. danoyes.com is a different url from https://www.danyoyes.com

    IMO, you must made a mistake in your search/replace of the database. Do you have access to the database tables, e.g. phpmyadmin? If so I would look at these two tables:
    wp_blogs
    wp_site

    Make sure the domain values are correct for site id = 1

    Thread Starter zakkates

    (@zakkates)

    Hmmm, I restored the old database and I ended up still getting the issue.

    Maybe something else is the matter.

    I submitted this to my host company for review.

    I’ll post the resolution here once I figure it out.

    zk

    Thread Starter zakkates

    (@zakkates)

    it was my fault…. is there a way I can delete this post? oops.

    No, what?, don’t delete it, what did you do?

    Thread Starter zakkates

    (@zakkates)

    hey, if you’re experiencing a similar issue you can reach out to me via DM on twitter: @zakkates and I’ll try to help out.

    This months ago so I don’t recall the exact solution, but, I can help you with your issue.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Changed Site URL in Multisite, Error Establishing Database in Wp-Admin’ is closed to new replies.