Support » Fixing WordPress » Restoring SQL database with a different prefix

  • I hope some MySQL guru can help me here.

    I was previously running WP 1.2, and decided to upgrade to 1.5. I had an SQL database where the tables had the prefix “wp_” — I saved this database to an *.sql file to back it up.

    The upgrade didn’t go well, I got frustrated, and eventually did a clean install. I tried to use the old database, but lo and behold, WP wouldn’t permit it, saying “it appears you’ve already installed WordPress.” So in my root/wp/wp-config.php file, I set the following variable:
    $table_prefix = ‘wp2_’;

    This gave me a fresh installation of WordPress, using the same SQL database as before, but with two sets of tables, wp_table and wp2_table.

    Now what I want to do is to import my backed-up SQL file so as to recover my old posts and comments. If I do a standard backup [], then the information simply returns to the old tables with the “wp_” prefix, which isn’t being read by my new installation of WP 1.5.

    My question, I suppose, is this: is there a way to conduct the reimportation of database information, but to alter the prefixes in the process? I’d like to put the “wp_” information into the newer “wp2_” tables. My follow-up question is, since these tables have all sorts of information other than just post and comment content, is doing this going to totally ruin my new installation? Are my old posts gone forever?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The URL of my blog is in case that’s useful.

    Mark (podz)


    Support Maven

    What ‘didn’t go well’ ?
    I’ve imported and rescued a number of databases from a variety of errors and though I’ve tried to write a guide it’s not a 1-2-3 type of task.
    If you want to email me, I’ll help as much as I can.
    Firstly I’d need your original .sql file which I will test, then once I have that working, if you give me access to your database I’ll get it all back in and running.
    Until I actually see the file I can’t promise, but I’ve not failed yet 🙂

    tamba2 at gmail dot com

    thank you Podz, I will email you the file.

    Three cheers for Podz! He successfully fiddled in the database until the situation was resolved. For anyone who has this issue in the future, know that it can be fixed, but unfortunately I can’t explain how.

    oh I need to know the procedures!!

    I need these instructions as well. How do you change the prefix successfully?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Restoring SQL database with a different prefix’ is closed to new replies.