• Resolved vixenk

    (@vixenk)


    I have 4 wordpress sites located on one server, and split between two databases (3 of them on one database, one of them on the other). I wanted to merge them together on to one database, so I backed one of the databases up and imported the backup in to the other database. Each of them have their own custom prefixes since they’re meant to share one database with others. I should also add that previous to doing this all the installations were working without a hitch.

    There has been no domain change or change in location of the wordpress installations, so after importing the only thing left to do should be to update wp-config on the appropriate installations to switch them over so they’re all using one database, right?

    It’s not working, though. I tested one and I simply get “Error establishing a database connection”. I copied and pasted the database login info from the site that was already using that database, and the only different things about the block I copied and pasted was the login name, server location, and password.

    I then tried switching back to the old wp-config file, which I kept backed up (plus I never deleted the test site’s original database that it was working with previously just in case something like this happened). But now I get the same error – “Error establishing a database connection”. Why on earth would it have been working before and then refuse to work now, and what can I do to fix it? It would be even better if someone could tell me how to switch to the database like I originally intended!

    All of these sites are using the same installation version of wordpress, just installed to different directories on the server.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Are you absolutely sure you haven’t introduced an extra space before or after a field value?

    For example this one would not work:
    define('DB_HOST', ' mysql.xhosting.com')
    this would work:
    define('DB_HOST', 'mysql.x10hosting.com');

    Thread Starter vixenk

    (@vixenk)

    This is from the site that was originally using the database I’m wanting to move the others to:
    <?php
    // ** MySQL settings ** //
    define(‘DB_NAME’, ‘wordpress’); // The name of the database
    define(‘DB_USER’, ‘wordpress’); // Your MySQL username
    define(‘DB_PASSWORD’, ‘password’); // …and password
    define(‘DB_HOST’, ‘pmysql.secureserver.net’); // 99% chance you won’t need to change this value
    define(‘DB_CHARSET’, ‘utf8’);
    define(‘DB_COLLATE’, ”);

    Now for the one that isn’t working (the original file and not the changed one):
    <?php
    // ** MySQL settings ** //
    define(‘DB_NAME’, ‘wordpress2’); // The name of the database
    define(‘DB_USER’, ‘wordpress2’); // Your MySQL username
    define(‘DB_PASSWORD’, ‘password2’); // …and password
    define(‘DB_HOST’, ‘psmysql1.secureserver.net’); // 99% chance you won’t need to change this value

    Just so you know, I did alter the db name, user, password, and host when posting these for security reasons, but that was all. ??

    The first one’s table prefix is the standard wp_. The second one’s table prefix is the site’s name, archive1. I can post those as well if you would like.

    I’m not sure if this makes a difference but the archive1 site was using mysql 4.0 and the database I’m trying to migrate to is mysql 4.1.

    This is a sample of what the database categories look like on the database I’m trying to migrate the archive1 site to (minus the “* Browse “):
    * Browse archive1comments
    * Browse archive1links
    * Browse archive1options
    * Browse archive1postmeta
    * Browse archive1posts
    * Browse archive1terms
    * Browse archive1term_relationships
    * Browse archive1term_taxonomy
    * Browse archive1usermeta
    * Browse archive1users
    * Browse beginningscomments
    * Browse beginningslinks
    * Browse beginningsoptions
    * Browse beginningspostmeta
    * Browse beginningsposts
    * Browse beginningsterms
    * Browse beginningsterm_relationships
    * Browse beginningsterm_taxonomy
    * Browse beginningsusermeta
    * Browse beginningsusers
    * Browse davidcomments
    * Browse davidlinks
    * Browse davidoptions
    * Browse davidpostmeta
    * Browse davidposts
    * Browse davidterms
    * Browse davidterm_relationships
    * Browse davidterm_taxonomy
    * Browse davidusermeta
    * Browse davidusers
    * Browse surrealitycomments
    * Browse surrealitylinks
    * Browse surrealityoptions
    * Browse surrealitypostmeta
    * Browse surrealityposts
    * Browse surrealityterms
    * Browse surrealityterm_relationships
    * Browse surrealityterm_taxonomy
    * Browse surrealityusermeta
    * Browse surrealityusers
    * Browse wp_comments
    * Browse wp_links
    * Browse wp_options
    * Browse wp_pflickr_cache
    * Browse wp_postmeta
    * Browse wp_posts
    * Browse wp_terms
    * Browse wp_term_relationships
    * Browse wp_term_taxonomy
    * Browse wp_usermeta
    * Browse wp_users

    I just used the phpMyAdmin export to backup database wordpress1 with prefix wp_. I then used phpMyAdmin to import that backup into database wordpress2. I then changed the orginial wp-config.php file to use the new DB_NAME, DB_PASSWORD, and DB_USER values. In my case the DB_HOST remained the same.

    Then the blog worked.

    Please review your steps. It sounds like you were doing things correctly, except that you can’t access your original site with the original database and wp-config.php values. I would figure out why that is.

    Thread Starter vixenk

    (@vixenk)

    I *have* reviewed them, repeatedly, not to mention it’s still not working with the ORIGINAL wp-config and database, the only two things I changed to begin with. I’m glad it worked for you, you did the same exact thing I did, but it’s not working for me. And if I could figure out why I wouldn’t be posting about it here.

    Thread Starter vixenk

    (@vixenk)

    You know what? Forget it. I’ll figure it out eventually and if I don’t, oh well.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘changing databases’ is closed to new replies.