Title: Restoring SQL database with a different prefix
Last modified: August 18, 2016

---

# Restoring SQL database with a different prefix

 *  [lanemcf](https://wordpress.org/support/users/lanemcf/)
 * (@lanemcf)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/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](http://codex.wordpress.org/Restoring_your_database_from_backup)[
   codex.wordpress.org], 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)

 *  Thread Starter [lanemcf](https://wordpress.org/support/users/lanemcf/)
 * (@lanemcf)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/restoring-sql-database-with-a-different-prefix/#post-200249)
 * The URL of my blog is [http://www.lanemcfadden.net](http://www.lanemcfadden.net)
   in case that’s useful.
 *  [Mark (podz)](https://wordpress.org/support/users/podz/)
 * (@podz)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/restoring-sql-database-with-a-different-prefix/#post-200256)
 * 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
 *  Thread Starter [lanemcf](https://wordpress.org/support/users/lanemcf/)
 * (@lanemcf)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/restoring-sql-database-with-a-different-prefix/#post-200295)
 * thank you Podz, I will email you the file.
 *  Thread Starter [lanemcf](https://wordpress.org/support/users/lanemcf/)
 * (@lanemcf)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/restoring-sql-database-with-a-different-prefix/#post-200387)
 * 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.
 *  [takuya](https://wordpress.org/support/users/takuya/)
 * (@takuya)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/restoring-sql-database-with-a-different-prefix/#post-201230)
 * oh I need to know the procedures!!
 *  [marky](https://wordpress.org/support/users/marky/)
 * (@marky)
 * [20 years, 3 months ago](https://wordpress.org/support/topic/restoring-sql-database-with-a-different-prefix/#post-201254)
 * 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.

## Tags

 * [database](https://wordpress.org/support/topic-tag/database/)
 * [MySQL](https://wordpress.org/support/topic-tag/mysql/)
 * [prefix](https://wordpress.org/support/topic-tag/prefix/)
 * [sql](https://wordpress.org/support/topic-tag/sql/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 6 replies
 * 4 participants
 * Last reply from: [marky](https://wordpress.org/support/users/marky/)
 * Last activity: [20 years, 3 months ago](https://wordpress.org/support/topic/restoring-sql-database-with-a-different-prefix/#post-201254)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
