现在的位置: 首页 > IT运维 > 正文

wordpress手工修改表前缀

2014年07月16日 IT运维 ⁄ 共 1398字 暂无评论 ⁄ 被围观 8+

wordpress手工修改表前缀的方法,例如将前缀 wp_ 修改为 changeto_:

修改wp-config.php

$table_prefix  = \'wp_\';
改成
$table_prefix  = \'changeto_\';(注:changeto修改为你想使用的数据库前缀)

修改数据库表前缀

进入wordpress的数据库,修改替换数据库表前缀,使用以下SQL语句:

ALTER TABLE wp_comments RENAME TO changeto_comments;
ALTER TABLE wp_commentmeta RENAME TO changeto_commentmeta;
ALTER TABLE wp_links RENAME TO changeto_links;
ALTER TABLE wp_options RENAME TO changeto_options;
ALTER TABLE wp_postmeta RENAME TO changeto_postmeta;
ALTER TABLE wp_posts RENAME TO changeto_posts;
ALTER TABLE wp_terms RENAME TO changeto_terms;
ALTER TABLE wp_term_relationships RENAME TO changeto_term_relationships;
ALTER TABLE wp_term_taxonomy RENAME TO changeto_term_taxonomy;
ALTER TABLE wp_usermeta RENAME TO changeto_usermeta;
ALTER TABLE wp_users RENAME TO changeto_users;

更新数据库内容中的配置

UPDATE changeto_options SET option_name = REPLACE(option_name, \'wp_user_roles\', \'changeto_user_roles\');
UPDATE changeto_usermeta SET meta_key = REPLACE(meta_key, \'wp_capabilities\', \'changeto_capabilities\');
UPDATE changeto_usermeta SET meta_key = REPLACE(meta_key, \'wp_user_level\', \'changeto_user_level\');
UPDATE changeto_usermeta SET meta_key = REPLACE(meta_key, \'wp_dashboard_quick_press_last_post_id\', \'changeto_dashboard_quick_press_last_post_id\');
UPDATE changeto_usermeta SET meta_key = REPLACE(meta_key, \'wp_user-settings\', \'changeto_user-settings\');
UPDATE changeto_usermeta SET meta_key = REPLACE(meta_key, \'wp_user-settings-time\', \'changeto_user-settings-time\');

给我留言

您必须 [ 登录 ] 才能发表留言!

×
#