• Okay, my end goal is to upgrade from WP 0.72 to 1.01
    Things went wrong, so I deleted everything, including the old files.
    I have backups of everything, I have a database backup, and I also have an exported database that I’m able to import again.
    Now, I think the best thing to do is install WP1.01, in fact, I already got that going too.
    But I want my OLD entries in there as well.
    My idea was:
    -create a new database for the new WP
    -import tables that contain content to new WP
    -changes names in config.php to make it work.
    But I can’t figure out how to get my old tables into the new database. There is no such thing as “copy table” in phpmysql, and when I search for an answer online, I only find chunks of mysql code that I don’t understand. I only know how to use phpmysql to export and import.
    Is there another way I can get my old entries in new WP? The table names are all different, upgrade doesn’t work, and if I let the new install overwrite I get all kinds of errors (I tried that) so the only thing that works is make a brand new database for the new installation. Now I just need my old tables in there, maybe only a few of them.
    Help?

Viewing 2 replies - 1 through 2 (of 2 total)
  • You just need to change the sql query that you got when you exported (that’s actually what all that text you import is, one big query) so that the appropriate bits have the new table name. For example:
    CREATE TABLE b2categories (
    blah blah, other lines in here about the table
    INSERT INTO b2categories VALUES (1, ‘Joy’, ‘joy’, ‘When I\’m happy.’, 0); etc
    change this to:
    CREATE TABLE newb2categories (
    blah blah, other lines in here about the table
    INSERT INTO newb2categories VALUES (1, ‘Joy’, ‘joy’, ‘When I\’m happy.’, 0); etc
    and so on everywhere there is something you want to change.
    I haven’t done this myself but my handy sql expert tells me my theory is right. Plus if you make a new copy of the text file to mess with plus a new database to run it into it won’t delete anything important if it doesn’t work right.
    Once you start thinking of the export thing as a big sql query you realise you can use it to do almost anything to the database.

    Yep, that’s exactly the answer I’d give — take a copy of the exported DB, assuming it is a .sql file, and just change all the old table names to the new ones.
    HOWEVER, Matt or someone would have to chime in on what exactly has changed in the database schema. That’s really what the upgrade script is for — to make sure that data is migrated properly to the newest schema, new fields/columns, new tables, new options, etc.
    If you’re trying to ‘avoid’ the ‘upgrade’ step, I’m guessing you can’t. ??
    -d
    https://www.chait.net

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Copy tables in database to other database?’ is closed to new replies.