• drgroove

    (@drgroove)


    Hello,

    I’m trying to help a colleague with a failed Multisite implementation.

    During development, WP was installed successfully with Multisite (sub-directory, not sub-domain) in a non-production environment. The site was pointed to a static IP address in wp-config.php.

    When WP/Multisite was launched into production (online), the IP was changed to a URL. After it was changed to a URL, the site fails with this error message:

    Error establishing database connection

    Here is a scrubbed copy of the wp-config.php file:

    <?php
    /**
     * The base configurations of the WordPress.
     *
     * This file has the following configurations: MySQL settings, Table Prefix,
     * Secret Keys, WordPress Language, and ABSPATH. You can find more information
     * by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
     * wp-config.php} Codex page. You can get the MySQL settings from your web host.
     *
     * This file is used by the wp-config.php creation script during the
     * installation. You don't have to use the web site, you can just copy this file
     * to "wp-config.php" and fill in the values.
     *
     * @package WordPress
     *
     */
    
    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define('DB_NAME', 'SOMENAME_wrdp5');
    
    /** MySQL database username */
    define('DB_USER', 'SOMENAME_wrdp1');
    
    /** MySQL database password */
    define('DB_PASSWORD', 'SOMEPASSWORD');
    
    /** MySQL hostname */
    define('DB_HOST', 'SOMEURL');
    
    /** Database Charset to use in creating database tables. */
    define('DB_CHARSET', 'utf8');
    
    /** The Database Collate type. Don't change this if in doubt. */
    define('DB_COLLATE', '');
    
    /**#@+
     * Authentication Unique Keys and Salts.
     *
     * Change these to different unique phrases!
     * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
     * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
     *
     * @since 2.6.0
     */
    define('AUTH_KEY',         'SALT');
    
    define('SECURE_AUTH_KEY',  'KEY');
    
    define('LOGGED_IN_KEY',    'KEY');
    
    define('NONCE_KEY',        'KEY');
    
    define('AUTH_SALT',        'SALT');
    
    define('SECURE_AUTH_SALT', 'SALT');
    
    define('LOGGED_IN_SALT',   'SALT');
    
    define('NONCE_SALT',       'SALT');
    
    /**#@-*/
    
    /**
     * WordPress Database Table prefix.
     *
     * You can have multiple installations in one database if you give each a unique
     * prefix. Only numbers, letters, and underscores please!
     */
    $table_prefix  = 'wp_';
    
    /**
     * WordPress Localized Language, defaults to English.
     *
     * Change this to localize WordPress.  A corresponding MO file for the chosen
     * language must be installed to wp-content/languages. For example, install
     * de.mo to wp-content/languages and set WPLANG to 'de' to enable German
     * language support.
     */
    define ('WPLANG', '');
    
    /**
     * WordPress Multisite settings.
     * Note that the available documentation on Multisite configuration is ... somewhat lacking (I'm being generous).
     */
    define( 'WP_ALLOW_MULTISITE', true );
    define('MULTISITE', true);
    define( 'SUBDOMAIN_INSTALL', false );
    $base = '/';
    define( 'DOMAIN_CURRENT_SITE', 'SOMEURL.com' );
    define( 'PATH_CURRENT_SITE', '/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );
    
    /**
     * For developers: WordPress debugging mode.
     *
     * Change this to true to enable the display of notices during development.
     * It is strongly recommended that plugin and theme developers use WP_DEBUG
     * in their development environments.
     */
    define('WP_DEBUG', false);
    
    /* 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');

    //

    I’m a professional PHP developer, and have been a Moderator on Devshed.com for almost a decade. However, this is my first foray into WordPress; before I start wholesale re-coding how WP handles database connectivity for Multisite installations, I wanted to see if anyone had recommendations on how to resolve this issue.

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The site was pointed to a static IP address in wp-config.php.

    When WP/Multisite was launched into production (online), the IP was changed to a URL.

    Go in the database and find all instances of the IP address and replace them with the full domain name.

    Yes, really. 🙂

    Thread Starter drgroove

    (@drgroove)

    Hi Andrea_r,

    Thanks for the response.

    My colleague got the MS to work. However, I will state that we tried the IP / URL search/replace prior to me posting this thread, and it did not work. We tried replacing the http://000.000.00.00 IP address with these variations:
    * http://www.website-name.com
    * http://website-name.com
    * http://www.website-name.com
    * website-name.com

    Ultimately, while this may have been a component of the solution (I’d have to ask my colleague again what it was she did to get it to work), it certainly was not a silver bullet. The same error message – Error Establishing Database Connection – came up after each IP/URL replace attempt.

    Well, it has to be in *all* places – not just testing each one at a time, and the same URL has to go in there. not different ones in different places.

    This is multisite. It’s stored *everywhere*. If it was single WP, it’s a simple switch. In multisite it is not.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Error establishing database connection’ is closed to new replies.