Daily Archives: 2009年06月29日

wp修改数据库表前缀

首先重命名数据库表,然后修改wp_config的表前缀,然后在替换掉数据库记录中的表前缀。

下面是相关的sql, wp是原来的表前缀,我修改为oldwp。

RENAME TABLE wp_awsomnews TO oldwp_awsomnews;
RENAME TABLE wp_comments TO oldwp_comments
RENAME TABLE wp_links TO oldwp_links
RENAME TABLE wp_options TO oldwp_options
RENAME TABLE wp_postmeta TO oldwp_postmeta
RENAME TABLE wp_posts TO oldwp_posts
RENAME TABLE wp_terms TO oldwp_terms
RENAME TABLE wp_term_relationships TO oldwp_term_relationships
RENAME TABLE wp_term_taxonomy TO oldwp_term_taxonomy
RENAME TABLE wp_usermeta TO oldwp_usermeta
RENAME TABLE wp_users TO oldwp_users

UPDATE oldwp_options SET option_name = REPLACE(option_name,’wp_user_roles’,’oldwp_user_roles’);
UPDATE oldwp_usermeta SET meta_key = REPLACE(meta_key,’wp_’,’oldwp_’);