WordPress的数据库表默认都是wp_,但是会有很多站长想要修改WordPress数据库的前置来提高安全性,那么修改WordPress数据库前缀方法是什么?

开始之前

修改数据是一件风险很高的工作,开始之前必然就是做好数据库备份

修改数据库前缀

打开你的 wp-config.php 文件,把数据库前缀 wp_ 改成你想要的前缀,比如 22vd_。

$table_prefix = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’22vd_\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’;

修改数据表名字

打开 PHPMySQL,找到你的数据库,然后执行以下 SQL,把所有数据库表前缀从 wp_ 改成 22vd_ 。

RENAME table \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’wp_commentmeta\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ TO \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’22vd_commentmeta\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’;

RENAME table \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’wp_comments\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ TO \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’22vd_comments\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’;

RENAME table \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’wp_links\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ TO \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’22vd_links\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’;

RENAME table \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’wp_options\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ TO \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’22vd_options\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’;

RENAME table \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’wp_postmeta\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ TO \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’22vd_postmeta\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’;

RENAME table \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’wp_posts\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ TO \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’22vd_posts\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’;

RENAME table \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’wp_terms\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ TO \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’22vd_terms\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’;

RENAME table \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’wp_term_relationships\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ TO \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’22vd_term_relationships\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’;

RENAME table \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’wp_term_taxonomy\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ TO \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’22vd_term_taxonomy\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’;

RENAME table \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’wp_usermeta\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ TO \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’22vd_usermeta\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’;

RENAME table \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’wp_users\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ TO \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’22vd_users\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’;

修改 Options 表中的数据

使用下面语句把 options 表中的 option_name 以 wp_ 开头的值改成 22vd_ 开头。

SELECT REPLACE(option_name, \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’wp_\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’, \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’22vd_\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’) FROM wpdx_options;

修改 UserMeta 表中的数据

使用下面语句把 UserMeta 表中的 meta_key 以 wp_ 开头的值改成 22vd_ 开头。

SELECT REPLACE(meta_key, \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’wp_\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’, \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’22vd_\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’) FROM wpdx_usermeta;

相关新闻

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

联系我们

联系我们

151-1101-0018

在线咨询:
邮件:30115776@qq.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信
关注微信
分享本页
返回顶部