优先提示:一定要先备份数据库,然后进行以下操作!!!切记!!!莫忘!!!
方法一:无需安装插件,将以下语句粘贴到sql查询界面后执行
DELETE FROM wp_comments WHERE comment_approved = 'trash';
DELETE FROM wp_commentmeta WHERE comment_id NOT IN (SELECT comment_id FROM wp_comments);
DELETE FROM wp_commentmeta WHERE meta_key LIKE '%trash%';
DELETE FROM wp_postmeta WHERE meta_key = '_edit_lock';
DELETE FROM wp_postmeta WHERE meta_key = '_edit_last';
DELETE FROM wp_postmeta WHERE meta_key = '_wp_old_slug';
DELETE FROM wp_postmeta WHERE meta_key = '_revision-control';
DELETE FROM wp_posts WHERE post_type = "revision";
DELETE FROM wp_posts WHERE post_status = "auto-draft";
DELETE from wp_comments WHERE comment_approved = '0';
TRUNCATE TABLE wp_commentmeta;
最后,在phpMyAdmin中,选中所有表,点“优化表”。此时你会发现数据库体积减小了很多。
方法二:使用clean-options和wp-clean-up两款插件
clean-options
一些插件的安装信息会储存在wp_options里,如果你经常折腾wordpress,那里此表中总会有冗余数据,用clean-options就可以自动清除之
首先点击“寻找孤立的选项”
之后系统会列出那些孤立无效的数据,如果有些数据你觉得是需要保留的,那就不要勾选。最后点击“查看选中的设置选项信息”
删除他们吧
wp-clean-up
wp-clean-up十分优秀,可以清除wordpress里大量无效的信息,比如修订版,草稿,订阅信息等。记得最后要点击“优化数据”
下载地址
wp-clean-up | clean-options | 来自猫头帮常任理事会
文章评论