WordPress.org

Ready to get started?Download WordPress

Forums

Advice on moving data from b2 to wp (6 posts)

  1. iampetesmith
    Member
    Posted 10 years ago #

    I've read a bunch of posts on this topic but I'm still a bit hazy.
    I was running b2, not a current version. Rather than upgrade b2, then move to WP, I just installed WP, using wp as the table prefix. I changed b2's config file to use b2blog.php rather than index.php.
    At that point, I had both packages running concurrently.
    Then I ran the import-b2.php script. It threw a bunch of SQL errors and didn't move any data over.
    Question 1: Have I fubar'd my WP installation by running import-b2.php? Everything *seems* to be working fine but if it would be better to start over from scratch, I'd rather do it now than after I've struggled with data migration.
    Question 2: Is there an elegant way to get the data out of b2posts table and into wp_posts? Or is it not quite that straightforward? Unfortunately I don't have shell access to the server I'm running on. I'm OK with SQL, but fairly clueless when it comes to PHP. I've rebuilt the categories table by hand, and don't care about losing the comments (since they were mostly porn spam...one of the reasons I needed to upgrade ... I needed the comment moderation). Actually, to be more accurate, I don't want the comments data, but I guess I could just drop that table.
    Any help would be much appreciated. I suppose I could resort to cutting and pasting but...ugh. I'd like to have this done before summer! :)

  2. Laughinglizard
    Member
    Posted 10 years ago #

    The most elegant method of moving data between b2 and wp is to use the old b2 tables and run the import-b2.php. The only catch is to make sure that the wp table prefix is the same as your b2 and the database names are the same in the config files.
    However, now that you have made yourself a new WP , here are my suggestions. PLEASE READ THROUGH ALL THE INSTRUCTIONS TO SEE THE CAVEATS AND PITFALLS
    1) You are going to need more than just the b2posts table to get your entries to move over correctly, so think about copying b2categories, b2posts and b2users (while you are at it, I would copy the b2comments and the b2settings as well, just for good measure)
    2) Now that you have created a new WP database, I am assuming that it does not contain any new entries. In order for the data to be successfully moved using this first method, you will HAVE TO HAVE the same table and table prefixes as b2. So, because it looks like your b2 tables had the 'b2' perfix, make that change in wp-config.php as well.
    3) Install phpMyAdmin from http://www.phpmyadmin.net/home_page/ and get it working correctly.
    4) Once installed, click on the dropdown menu on the left hand frame and click on your database. Now on the right, click on the export tab and Click on the tables you want to export from the table list. Accept all default checkbox settings (SQL, Structure, Enclose table names in backquotes and data checked) but also make sure the 'Save as File' is checked. Export the data to your local computer (this is also a very good way to backup your mysql data.
    5) Now find the new wordpress database on the left dropdown menu. Click on the SQL tab on the right and browse for your newly created SQL file and click go.
    6) Run import-b2.php
    Caveats: You could perform the same export table by table and import table by table. In that case you could name your table prefix with anything you want to.
    If you replace your wp-config.php table prefix now, your WordPress installation will stop working and new one will be created with the new table prefix and all of your b2 data
    Be careful when you move data around in mysql, if phpMyadmin asks you any questions that really confuse you or worry you, you should stop and check around. However, you said you were conversant with mysql, so I will leave you here.
    Also, I couldnt tell from your post whether you used a new database or the same one from b2 to install WP. The instructions here assume that you created a new database for WP.
    Peace

  3. iampetesmith
    Member
    Posted 10 years ago #

    Thanks LL! My host already has phpmyadmin installed and I'd already done dumps of my data, so I've got that covered. I only get one database, though, so have the b2_ tables and the wp_ tables in the same database.
    I only have 1 user (me) and 4 categories, and I've tweaked the settings in WP already.
    It sounds like I can just import the b2posts into wp_posts, then? I think I'll try doing this on a local copy of WP and see what happens... I've never used MySQL before...we use Oracle at work (and sometimes SQL Server) so I'm ok with SQL syntax, but not the specific MySQL dialect. And I'm certainly no DBA! :)
    I'll let you know how it all works out, and again, than you for the detailed reply. Its much appreciated.

  4. Mido
    Member
    Posted 10 years ago #

    I tried the upgrade file (import-b2.php) and got a) no result or b) errors or c) worse ;-)
    Seems that by manipulating tables via PhpMyAdmin is the solution, though it must be done really carefully. Way to do it safely ? Backup b2 tables. Remove. Install WP, backup wp tables. Dump b2 tables. Work on them. Should be all right...
    iampetesmith, I love you ^__^ err... well, a bit, at least... :-P I should have thought of that myself ^__^, Must have been too tired to think properly ...

  5. Amy
    Member
    Posted 10 years ago #

    Hi, I'm following your instructions to the T (I think), LaughingLiza, but there's this error. The error from phpMyAdmin said:
    "Error
    SQL-query : 
    CREATE TABLE b2categories (
    cat_ID int( 4 ) NOT NULL AUTO_INCREMENT ,
    cat_name tinytext NOT NULL ,
    KEY cat_ID ( cat_ID )
    ) TYPE = MYISAM AUTO_INCREMENT = 15
    MySQL said:
    Table 'b2categories' already exists"
    You see, I set up in wp-config.php to have the same b2 prefix as the old b2 tables. Yet the error said the b2categories already exists because there's already a b2categories in the new WP database. Was I supposed to do that or create different tables? I'm a little confused here. I'd appreciate for any assistance on this. I already backed up everything so I have nothing to worry about and I'm upgrading from b2 .0.6.2 to WP. Thanks.

  6. Amy
    Member
    Posted 10 years ago #

    Never mind...I got it all figured out and is up and running smoothly without snags so far. A breather helped. ;) This is GREAT program, much better than b2 in comparsion. I'm glad I upgraded to WP. Great job to developers who created this software.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.