WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Migrating WPMS from apache to IIS7 causes Database Error (23 posts)

  1. Josh Maxwell
    Member
    Posted 2 years ago #

    I have a large multisite installation hosted on XAMPP on an XP 2003 server and am trying to move it to a new Windows 2008 server with IIS7.

    I can successfully get fresh installs of WP up and running and can get multisite working perfectly. But, when I import my old WPMS MySQL database and change the DB_NAME in my wp-config.php file to have the old WPMS database instead of the new WPMS database, I'm hit with "Error establishing database connection"

    Here are my wp-config.php settings:

    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define('DB_NAME', 'migrated_WPMS_database');
    
    /** MySQL database username */
    define('DB_USER', 'wpms_user');
    
    /** MySQL database password */
    define('DB_PASSWORD', 'wpms_password');
    
    /** MySQL hostname */
    define('DB_HOST', 'localhost');
    
    /** 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', '');

    I've double checked the username & password and even changed them several times to make sure they matched up. I've tried localhost, 127.0.0.1, and the IP address of my server itself for the DB_NAME. Nothing.

    Does anyone have any ideas or had this issue before?

  2. Josh Maxwell
    Member
    Posted 2 years ago #

    // UPDATE

    I've successfully connected to the database finally!

    Visiting the front page of the domain (http://domain.com) gave me the Error establishing database connection message, but trying to visit the dashboard/admin area (http://domain.com/wp-admin) helped me see the problem: In my many DB/user name changes, I neglected to give full permissions to wpms_user_2012 on migrated_DB_2012. D'OH!

    New Problem

    I still get the database error when visiting the front page, but now when I visit /wp-admin, I see the following:

    One or more database tables are unavailable. The database may need to be repaired.

    When I follow the "repair" link, it walks me through the auto-repair sequence, but since this is a multisite installation, it skips over a few tables and tells me the following tables don't exist:

    • wp_posts
    • wp_comments
    • wp_links
    • wp_options
    • wp_postmeta
    • wp_terms
    • wp_term_taxonomy
    • wp_term_relationships
    • wp_commentmeta

    Only, these tables do exist, but they exist as: wp_1_posts,
    wp_1_comments, etc.

    What should the next steps be to get my migrated DB to work properly?

  3. How did you import the db?

    Have you run a repair on the DB just to be sure?

    If you use a different DB (say one that was created on that server) does it work?

  4. Josh Maxwell
    Member
    Posted 2 years ago #

    Ipstenu, thanks for the reply.

    For this installation, I started from scratch with a fresh install of WP, set it up with a network and then copied the old /blogs.dir over to the new wp-content/.

    (Reasoning for fresh install: I believe my old site had been hacked and I wanted to prevent any compromised core files from being transferred over to the new server.)

    Next, I imported my old database (migrated_WPMS_database) into MySQL via phpMyAdmin, gave the appropriate privileges to the wpms_user and set up wp-config.php with the proper database/user/password information.

    I ran the WP repair and you can see my follow-up comment for the results. Basically, it was telling me that the main site's tables weren't there: I've read that the "repair" feature doesn't work well with WPMS because it looks for wp_[tableNames] instead of wp_1_[tableNames]. Am I mistaken?

    After this, I even went through phpMyAdmin and ran it's built in "repair", also.

    I can still connect successfully to the fresh install's database (test_database) if I change wp-config.php accordingly. So, it is seeing that it is a network and it is able to connect to the database server successfully, too.

    Based on the WP Repair results, it seems WP is still looking for wp_[tableNames] instead of wp_1_[tableNames], is that right? Why would it do this? There's got to be something I'm missing inside the migrated database's tables or something, because of the message I receive when trying to access wp-admin:

    One or more database tables are unavailable. The database may need to be repaired.

    If it helps, my OLD site was set up as WPMU back before the merge, so the OLD wp-config.php is set up slightly different, and if I use it instead of the newer 3.3 wp-config.php, my front-end becomes a blank screen and I'm able to get to the wp-login screen but it just puts me into a redirect loop back to the login page.

  5. If it helps, my OLD site was set up as WPMU back before the merge, so the OLD wp-config.php is set up slightly different, and if I use it instead of the newer 3.3 wp-config.php, my front-end becomes a blank screen and I'm able to get to the wp-login screen but it just puts me into a redirect loop back to the login page.

    *ugh* That makes 'sense'.

    Okay, don't use the WordPress repair tool. It has weird issues with the old WPMU upgraded installs. Just go in and run a repair through phpMyAdmin.

  6. Josh Maxwell
    Member
    Posted 2 years ago #

    Here are the wp-config files to compare:

      They're both WPMS now, but I'm using MU & MS to differentiate between the two files. Still basically the same, just a few things have changed in wp-config.php.

      For example, the old file used define('VHOST', 'no'); to say to use subdirectories & not subdomains. New version uses define( 'SUBDOMAIN_INSTALL', false );.

      I guess there could be something here that's causing the problem, but I'm not sure. So frustrating...

  7. Josh Maxwell
    Member
    Posted 2 years ago #

    Ipstenu, I have repaired the files via WordPress and phpMyAdmin already... :(

    I'll try resetting IIS & clearing caches to see if that's all that's happening now.

    //edit

    That did not work :/

    Hmm, I'll try reimporting the database, because I DID try to use the built in WordPress repair tool before I tried via phpMyAdmin. We'll see if that makes a difference :)

  8. It might. Also double check what versions of MySQL you were running on the old and new machines.

    Is there any possibility of using the WordPress importer?

  9. Josh Maxwell
    Member
    Posted 2 years ago #

    I didn't think about the MySQL versions. I'll check into that. If they are different, what can I do to get my old DB to play nice with the new version of MySQL?

    I have roughly 150 sites, so the Importer isn't totally out of the question, but it is definitely a last resort :/

  10. Yowch.

    The difference should only matter if it's a major release (like 5.2 to 5.3).

  11. Josh Maxwell
    Member
    Posted 2 years ago #

    Well, looks like the old one was 5.1.41 & the new one is 5.1.57, so that's out. And, I tried reimporting and repairing via phpMyAmin only this time to no avail.

    Even though this is from an upgraded WPMU install, shouldn't I be able to import the DB from WPMU into a newer WPMS site? At least, in theory I'd think so.

  12. Yes, you should be able to just pick the DB up, and the files, and drop it on the new box... The only thing that's left is the fact that you're going from Apache to IIS...

  13. Even though this is from an upgraded WPMU install, shouldn't I be able to import the DB from WPMU into a newer WPMS site? At least, in theory I'd think so.

    Yes... except for the main site. You HAVE TO rename the tables from wp_1_whatever to just wp_whatever.

  14. Josh Maxwell
    Member
    Posted 2 years ago #

    Andrea_r, thanks for the response! That let me get to the login screen.

    Was that a recent change? Or something implemented during the merge? Or just something you have to do when moving between Apache & Windows?

    I'm getting a redirect loop on the login screen for the main site; however, I'm able to login to my sub-sites with the admin login info and get to all my subsites' dashboards. It looks like all the posts are there; the Media links are broken.

    All my sites are giving me a blank screen when I visit the front-end and I can't get to the network dashboard or log into the main site's dashboard for the life of me.

    Off to research these new problems :)

  15. I imagine if you just picked up everything and dropped it in the new place, files and DB and all, it would have been okay...

  16. Josh Maxwell
    Member
    Posted 2 years ago #

    :/ Agreed.

    Buuut, my SysAdmin told me he was getting some weird outgoing traffic coming from our WPMU site; then we received an email from our ISP: they were getting DDOS attacks coming from our WPMS site. I did everything I could think of to track down the culprit(s), but nothing's worked and whatever is doing this has just been scanning through our ports to find an open one for it to use to do whatever it's going to do :(

    We've been needing to switch our blogs to this new server anyway, so I figured this would be as good a time as any. I knew it'd be a tough transition - move from XAMPP on XP '03 to Win08 IIS7 - but I had no idea I'd have this much trouble.

    I may end up having to do a back up of everything I have done so far and try what you suggested: just pick it all up, drop it on the new server, pray there's no malicious code hitch-hikers and see what happens.

    Still, I'd love to figure this out for future reference (for myself and others).

  17. They didn't happen to get a brain and tell you where the traffic was from past 'you' ... I mean, my SysAdmin has often said 'That mail form's getting hammered.'

  18. Josh Maxwell
    Member
    Posted 2 years ago #

    Unfortunately, no. I guess it's technically a "port scanner", something on our server looking for a way out through an open port to do damage elsewhere/outside our network. But there's no way to know for sure where on the site or from what directories it's coming from.

    // UPDATE

    SUCCESS! (sort of)

    I was comparing my old wp_options table with the newly created one (from the fresh install) and "thought maybe these are different." I backed up my old one and copied the new wp_options table over to the migrated_WPMS_database... voila! I can see the front page of my main site!

    I still can't login from my.domain.com/wp-login.php or access the main site's dashboard yet and I still see blank front page on my subsites, buuut, this tells me that there's something missing from my old wp_X_options tables for each blog that is included in newer versions of WPMS' tables.

    There's light at the end of the tunnel ... I know it now, I just can't see it yet :D

  19. Josh Maxwell
    Member
    Posted 2 years ago #

    Ok, more headway... the whole front-end being blank thing was totally my fault. I hadn't copied the themes folder over yet... So the database was looking for themes & stylesheets that weren't there. Gah!

    Moving on from my stupidity...

    Still working on the login page's redirect loop: I'm wondering if there's a connection here with why I'm unable to access the Network Admin dashboard? Any ideas?

    // UPDATE

    On a roll now! I remembered I had backed up my old wp_blog_versions so I could try the fresh install's version of it: I switched it back to the old one, cleared the cache & cookies and I'm back up!

    I'm able to login without issue to my main site & the network dashboard is accessible!

    The very last issue I have now is getting the media files to work properly again.

  20. Media files. Make sure your .htaccess is set up right.

  21. Josh Maxwell
    Member
    Posted 2 years ago #

    My install is running off of IIS7. And, I'm using the default code created by WordPress for my web.config. I'm having trouble finding help on getting the web.config file setup to see the old files properly...

    The weird part is when I look at my Media Library, it's displaying some files' thumbnails. But, it seems the image files are the one's having problems because some of my PDFs and docs are actually linked properly ... ???

    --------------

    On another note: I had to go back and do another fresh install, this time via Microsoft's Web Web Platform Installer, because I couldn't find the IUSR account to add it to the folder's permissions.

    So, for future reference for anyone who finds this thread:
    The best way to get the proper permissions on your folders/files while using IIS7 is to install WordPress via Microsoft Web Platform Installer.

  22. Josh Maxwell
    Member
    Posted 2 years ago #

    Well, the original "Database Issue" has been resolved, so I'm going to mark as such and create a new post for my Media Library issues.

    Thanks so much Ipstenu & Andrea_r for your help!

  23. Josh Maxwell
    Member
    Posted 2 years ago #

    In case anyone was wondering or wanted to see the continuation of this thread: Media Library won't recognize SOME files after move.

Topic Closed

This topic has been closed to new replies.

About this Topic