WordPress 修改数据库前缀
背景
有时候想要迁移服务器,但是另一台服务器上也有一台wordpress程序,并且数据库表明和当前旧服务器表明一致,在不更换数据库的情况会导致表冲突,可以采用修改表名前缀来防止冲突。
注意:操作有风险,注意数据库备份。
操作
1、修改wordpress程序根目录下的wp-config.php文件里面的table_prefix字段wp_ 改为你的前缀名称。
2、统一批量修改数据库表名。
RENAME table wp_commentmeta TO ty_commentmeta;
RENAME table wp_comments TO ty_comments;
RENAME table wp_links TO ty_links;
RENAME table wp_options TO ty_options;
RENAME table wp_postmeta TO ty_postmeta;
RENAME table wp_posts TO ty_posts;
RENAME table wp_terms TO ty_terms;
RENAME table wp_term_relationships TO ty_term_relationships;
RENAME table wp_term_taxonomy TO ty_term_taxonomy;
RENAME table wp_usermeta TO ty_usermeta;
RENAME table wp_users TO ty_users;
3、完成。
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END