Wordpress migration

From brainsik
Jump to navigation Jump to search

I used to have a single wordpress DB that all the wordpress blogs were in; blogs were differentiated by table prefix. While migrating the blogs to a new machine I decided to keep each blog in its own DB. I also wanted each wordpress DB to use the exact same table names and decided to just drop the table prefix altogether. These are some of the important steps I needed to do. In particular, I had to manually modify the tables.

Migrate themes and uploads

Make sure themes and upload content has been copied to the new machine. If the theme is missing, then Wordpress may automatically update the blog to use the "default" theme.

Rename the tables

This assumes your table prefix is the default "wp_" -- change it to whatever is appropriate: s/wp_/prefix_/

alter table wp_categories rename to categories ;
alter table wp_comments rename to comments ;
alter table wp_link2cat rename to link2cat ;
alter table wp_links rename to links ;
alter table wp_options rename to options ;
alter table wp_post2cat rename to post2cat ;
alter table wp_postmeta rename to postmeta ;
alter table wp_posts rename to posts ;
alter table wp_usermeta rename to usermeta ;
alter table wp_users rename to users ;

Update privileges

Updates tables so people can log in and receive their permissions. Deals with the problem where people login and then get the message: "You do not have sufficient permissions to access this page."

Again, this assumes the table prefix is the default "wp_" -- change it to whatever is appropriate: s/wp_/prefix_/

update options set option_name = 'user_roles' where option_name = 'wp_user_roles' ;
update usermeta set meta_key = 'capabilities' where meta_key = 'wp_capabilities';
update usermeta set meta_key = 'user_level' where meta_key = 'wp_user_level';