如何在WordPress中从MySQL恢复博客



重新安装wordpress后,所有的博客都消失了。但是当我查看数据库时,我发现博客仍然存在于数据库中。如何提取博客并再次将其放入wordpress中?

首先,立即备份数据库。

之后 - 检查您的wp-config值是否正确(DB namePassDB userDB address DB prefix。 (我敢打赌你的前缀是错误的.

然后,如果没有问题 - 检查您的数据库是否有blog_url并在wp_options内部home_url正确的值。

在你的问题中 - 你说过:

重新安装wordpress后,所有博客都消失了

一.你说的reinstall是什么意思 - 你是否

  1. 只是FTP文件,或

  2. 运行安装脚本?

如果 ( 1 == true ) 那么你可能已经覆盖了.htaccesswp-config

如果(2==true)那么可能是db前缀。(但也可以更严重)

B :既然你说all the blogs复数 - 这是多站点安装吗? 如果上述方法不起作用,这将使事情变得更加复杂。

编辑我 - 好吧 - 看来我对前缀没有错..

Rename table old_prefix_commentmeta to new_prefix_commentmeta;
Rename table old_prefix_comments to new_prefix_comments;
Rename table old_prefix_links to new_prefix_links;
Rename table old_prefix_options to new_prefix_options;
Rename table old_prefix_postmeta to new_prefix_postmeta;
Rename table old_prefix_posts to new_prefix_posts;
Rename table old_prefix_terms to new_prefix_terms;
Rename table old_prefix_term_relationships to new_prefix_term_relationships;
Rename table old_prefix_term_taxonomy to new_prefix_term_taxonomy;
Rename table old_prefix_usermeta to new_prefix_usermeta;
Rename table old_prefix_users to new_prefix_users;

之后,您需要编辑new_prefix_options表(正式old_prefix_options):

您需要将old_prefix_user_roles更改为 new_prefix_user_roles

现在,将更改应用于正式new_prefix_usermetaold_prefix_usermeta

更改 meta_key 下的每个值,该值从old_prefix开始到new_prefix。数量或记录会有所不同,具体取决于您以前的配置、插件、主题等。

一些常见的可以是:

old_prefix_capabilities to new_prefix_capabilities
old_prefix_autosave_draft_ids to new_prefix_autosave_draft_ids
old_prefix_user_level  to new_prefix_user_level
old_prefix_usersettings to new_prefix_usersettings

最好的方法是在 PHPMyadmin 中使用 meta_key like old_prefix_% 运行搜索。

也有插件(链接),但我不是100%确定它可以提供帮助,因为您实际上还没有安装系统。(但供将来参考)

无论如何 - 你仍然没有说它是否是多站点 - 但基本上它是相同的(只有在多站点中,您将有多个选项可以更改......

至于"丢失"主题和样式 - 只要这些不是用 DB wit hsome 插件(样式)编写的,那么仅仅重新激活主题应该就可以了..

最新更新