Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have nearly completed a project but forgot in the first place to change the wp_ db prefix on install. Now i am a little bit worried to change it afterwards in fear of breaking the whole installation. Therefor the question if these described methods still work with 3.8.x or has anything change since then?

http://www.wpbeginner.com/wp-tutorials/how-to-change-the-wordpress-database-prefix-to-improve-security/

http://digwp.com/2010/10/change-database-prefix/

and have only table and field names to be changed? cuz i also saw a few prefixes starting with wp instead of wp_ ? Best regards Ralf

share|improve this question

1 Answer 1

up vote 4 down vote accepted

The basic idea should work-- change the prefix in both wp-config.php and in the database itself. What isn't covered would be cases where the prefix is used in other contexts such as when used as part of a "meta" key. Those cases you would need to trace down one by one.

You could also have trouble it the prefix has been hard-coded into anything, but hopefully that isn't the case.

The safe thing to do, if you are able would be to copy the entire database to a database with a different name, and alter the second database. Switching between the two would be a simple edit of the database name in wp-config.php and you would have nearly no chance of data loss if you make a mistake, just make sure no one is editing the site while you play with it.

I'd download a complete backup of the site to disk, just to be 100% safe.

share|improve this answer
    
yeah in the first place, before i start i would make a backup. Creating a second database and alter there might be a real good idea. about potential hard coded prefixes i am worried too indeed. and a question you mentioned the cases not covered like "part of a meta key". Does that mean there might be cases aside the fieldname prefixes in the options and usermeta table. which wouldn't be covered with the two select statements? –  rpk Mar 23 at 17:43
1  
Yes, I have seen cases where the database prefix is part of the key. In fact, it looks like the Core does that with some usermeta keys, but I'd have to do more research to be sure. –  s_ha_dum Mar 23 at 18:03
    
ahhhh i see. oki doki. then i guess i just backup the db create also a second "try out" version and then apply the three steps from the posts to my 3.8.1 install. i think i shouldn't worry that much beforehand and just do. ;) thanks! –  rpk Mar 23 at 18:20
1  
I ran into this very thing recently - if you are looking for some easy queries to run (after making a backup of your db) try this script on for size github.com/codearachnid/wordpress-snippits/blob/… –  codearachnid Mar 25 at 21:50
    
@codearachnid nice one. thanks. a few meta_keys are missing in my db when i crosschecked but i guess those are db entries related to functions i have disabled in wp right now –  rpk Mar 28 at 12:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.