新手指南:如何从备份还原WordPress

Do you need to restore WordPress from a backup file? Backups help you restore your website in case something goes wrong. However, restoring WordPress from a backup file is not easy for beginners. In this article, we will show you how to easily restore WordPress from backup step by step.

您需要从备份文件还原WordPress吗? 备份可以帮助您在出现问题时恢复网站。 但是,对于初学者而言,从备份文件还原WordPress并不容易。 在本文中,我们将逐步向您展示如何轻松地从备份中还原WordPress。

How to Restore WordPress from Backup

Since this is a lengthy article, we have added table of contents for easier navigation.

由于这是一篇冗长的文章,因此我们添加了目录以便于导航。

Note: This guide is about restoring a WordPress site from backup. If you are trying to move your website to a new domain, then you should check out our guide on moving WordPress to a new domain without losing SEO.

注意:本指南是关于从备份还原WordPress网站。 如果您尝试将网站移至新域,则应查阅我们的有关将WordPress移至新域而不丢失SEO的指南

If you are trying to move from localhost to a live web hosting account, then follow this guide on how to move WordPress from local server to live site.

如果您尝试从localhost转移到实时网络托管帐户,请按照本指南说明如何将WordPress从本地服务器转移到实时站点

了解备份和还原WordPress (Understanding Backups and Restoring WordPress)

There are different ways to create backups for your WordPress site. The best way to create a backup is by using a WordPress backup plugin.

有多种方法可以为您的WordPress网站创建备份。 创建备份的最佳方法是使用WordPress备份插件

Alternately, you can also create manual backup of your WordPress database and download your WordPress files using FTP.

或者,您也可以为WordPress数据库创建手动备份,使用FTP下载WordPress文件。

Restoring WordPress from backups depends entirely on how you created the backup. For example, backups created using BackupBuddy or UpdraftPlus can be restored by using the same plugin. Similarly, manual backups need to be manually restored.

从备份还原WordPress完全取决于您创建备份的方式。 例如,可以使用同一插件恢复​​使用BackupBuddyUpdraftPlus创建的备份。 同样,手动备份需要手动还原。

A lot of WordPress users don’t backup their entire websites. Instead, they only backup their theme, uploads directory, and their WordPress database. This reduces their backup size, but increases the steps needed to restore the site.

许多WordPress用户不会备份他们的整个网站。 相反,他们只备份主题,上载目录和WordPress数据库。 这样可以减小其备份大小,但是增加了还原站点所需的步骤。

No matter how you created your backup, the basic steps are the same.

无论您如何创建备份,基本步骤都是相同的。

Let’s take a look at how to restore your WordPress site from backup. Since we’re covering different restore methods, please skip to the section that applies to you.

让我们看一下如何从备份还原WordPress网站。 由于我们涵盖了不同的还原方法,请跳至适用于您的部分。

从BackupBuddy备份文件还原WordPress (Restoring WordPress from BackupBuddy Backup File)

BackupBuddy is a popular premium WordPress backup plugin. If you used BackupBuddy to create backups, then this section is for you.

BackupBuddy是一个受欢迎的高级WordPress备份插件。 如果您使用BackupBuddy创建备份,那么此部分适合您。

BackupBuddy offers a very convenient way to restore WordPress from a backup. You need to login to your WordPress website and go to BackupBuddy » Restore/Migrate page.

BackupBuddy提供了一种非常方便的方式来从备份中还原WordPress。 您需要登录WordPress网站并转到BackupBuddy»恢复/迁移页面。

You will need to download a copy of importbuddy.php file. In the process, you will be asked to provide a password for importbuddy. This password will be used when you restore your website.

您将需要下载importbuddy.php文件的副本。 在此过程中,系统将要求您提供importbuddy的密码。 恢复网站时将使用此密码。

Download importbuddy

Next, you need to download a copy of your backup if you haven’t already done so. You can download it from BackupBuddy » Backups or the destination that you used to store your backups.

接下来,您需要下载备份副本(如果尚未下载)。 您可以从BackupBuddy »备份或用于存储备份的目标位置下载它。

Once you have the backup zip file and importbuddy.php stored on your computer, connect to your website using FTP.

将备份zip文件和importbuddy.php存储在计算机上之后,请使用FTP连接到您的网站。

If you have a complete backup of your website, then delete all files and folders from your server.

如果您拥有网站的完整备份,请从服务器中删除所有文件和文件夹。

However, if you have a partial backup, then you need to first download the files that you haven’t backed up. Once you are sure that you have everything backed up, proceed deleting all files and folders from your website’s root directory.

但是,如果您进行了部分备份,则需要先下载尚未备份的文件。 确定已备份完所有内容后,请继续从网站的根目录中删除所有文件和文件夹。

Delete old WordPress files

Next you need to upload your BackupBuddy backup and importbuddy.php files to your website’s root folder.

接下来,您需要将BackupBuddy备份和importbuddy.php文件上传到网站的根文件夹。

Once both files are uploaded to the server, visit importbuddy.php in your web browser. It is in your website’s root directory, so its URL will be something like:

将两个文件都上传到服务器后,在Web浏览器中访问importbuddy.php。 它在您网站的根目录中,因此其URL类似于:

http://www.example.com/importbuddy.php

http://www.example.com/importbuddy.php

ImportBuddy will now ask for the password that you created when you downloaded ImportBuddy.

现在,ImportBuddy将询问您在下载ImportBuddy时创建的密码。

importbuddy password

On the next screen, ImportBuddy will display the backup file you uploaded. In case you did not upload your backup file using FTP, then you can click on the upload tab to upload the backup file now. If you have your backups stored on iTheme’s Stash storage service, then you can connect to it by clicking on stash tab now. Once you have selected your database, click on Next Step to continue.

在下一个屏幕上,ImportBuddy将显示您上载的备份文件。 如果您没有使用FTP上传备份文件,则可以单击“上传”选项卡立即上传备份文件。 如果您的备份存储在iTheme的“存储”存储服务中,则可以通过单击“存储”选项卡立即连接到它。 选择数据库后,单击“下一步”继续。

Select your backup file

ImportBuddy will unzip your backup file and show you a success message when it has extracted the files. Click on the next step button to continue.

ImportBuddy将解压缩您的备份文件,并在提取文件后显示一条成功消息。 单击下一步按钮继续。

On the next screen, ImportBuddy will ask you to provide site URL and database information.

在下一个屏幕上,ImportBuddy将要求您提供站点URL和数据库信息。

If you are restoring a hacked WordPress website or trying to remove malware, then you do not want to use your old database.

如果您要恢复被黑的WordPress网站或尝试删除恶意软件,则您不想使用旧数据库。

You can either drop tables from your old database using phpMyAdmin, or create a new database using cPanel. Once you are done creating a new database or emptying the old one, provide your database details.

您可以使用phpMyAdmin从旧数据库中删除表,也可以使用cPanel创建新数据库。 完成创建新数据库或清空旧数据库后,请提供数据库详细信息。

On the other hand, if you are sure your site wasn’t hacked, then you can use the same old database details.

另一方面,如果您确定自己的网站未被黑客入侵,则可以使用相同的旧数据库详细信息。

database settings

Click on the next button to continue and importbuddy will now test your database settings and import your data. Once it is done, click next step to continue.

单击下一步按钮继续,并且importbuddy现在将测试您的数据库设置并导入数据。 完成后,请单击下一步继续。

Now ImportBuddy will update your site URLs, paths, etc. After that, you will be asked to test your site. If everything is working fine, then you have successfully restored your website.

现在,ImportBuddy将更新您的站点URL,路径等。之后,将要求您测试您的站点。 如果一切正常,则说明您已成功还原网站。

Review and cleanup

On the importbuddy page, click ‘Clean up and remove temporary files’ button. This will delete temporary data in database and files created during restoration.

在importbuddy页面上,单击“清理并删除临时文件”按钮。 这将删除还原过程中创建的数据库和文件中的临时数据。

使用UpdraftPlus备份还原WordPress (Restoring WordPress using UpdraftPlus Backup)

UpdraftPlus is another popular WordPress backup plugin. It allows you to easily backup and restore your WordPress site.

UpdraftPlus是另一个流行的WordPress备份插件。 它使您可以轻松备份和还原WordPress网站

First you need to make sure that you have a complete backup of your WordPress site created by UpdraftPlus. Next, you need to download the backup files to your computer.

首先,您需要确保具有UpdraftPlus创建的WordPress网站的完整备份。 接下来,您需要将备份文件下载到计算机上。

If your backups are stored by UpdraftPlus on a remote storage location like Dropbox, Google Drive, etc, then you can download your backup files from those locations to your computer.

如果您的备份是由UpdraftPlus存储在Dropbox,Google Drive等远程存储位置上的,那么您可以将备份文件从这些位置下载到计算机上。

Next, you need to connect to an FTP client and delete all WordPress files. After that you need to install WordPress again and login to your website.

接下来,您需要连接到FTP客户端并删除所有WordPress文件。 之后,您需要再次安装WordPress并登录到您的网站。

You will need to install and activate the UpdraftPlus plugin. Upon activation, visit Settings » UpdraftPlus Backups page and click on the Restore button.

您将需要安装并激活UpdraftPlus插件。 激活后,访问设置»UpdraftPlus备份页面,然后单击恢复按钮。

Upload your backup files

Next, you need to click on the ‘Upload backup files’ link and then uplaod the backup files you downloaded earlier.

接下来,您需要单击“上传备份文件”链接,然后对您先前下载的备份文件进行升级。

Uploading backup files

Once your backup files are uploaded, UpdraftPlus will scan those files and will show them on the backups page.

备份文件上传后,UpdraftPlus将扫描这些文件并将其显示在备份页面上。

You will need to click on the ‘Restore’ button to proceed.

您需要单击“还原”按钮才能继续。

Restore backup files

This will bring up a popup where you need to click on the restore button again to continue. Make sure that all available backup files such as plugins, database, themes and others are selected.

这将弹出一个弹出窗口,您需要再次单击恢复按钮才能继续。 确保已选择所有可用的备份文件,例如插件,数据库,主题等。

Restoring backup files

UpdraftPlus will now start extracting and restoring data from those files. Upon success, you will be redirected to the success page.

UpdraftPlus现在将开始从这些文件中提取和还原数据。 成功后,您将被重定向到成功页面。

Backup restored

That’s all, you have successfully restored your WordPress site from an UpdraftPlus backup.

就是这样,您已经从UpdraftPlus备份中成功还原了WordPress网站。

使用phpMyAdmin从备份还原WordPress数据库 (Restoring WordPress Database from Backup using phpMyAdmin)

When restoring a manually created backup, you may come across two possible choices. You can either create a new database and import your backup into it, or you can empty your existing database and import backup.

在还原手动创建的备份时,您可能会遇到两个可能的选择。 您可以创建一个新数据库并将备份导入其中,也可以清空现有数据库并导入备份。

If you are cleaning a hacked WordPress website, then it is very important to change your MySQL username and password before creating a new database or importing into existing database.

如果您要清理被黑的WordPress网站,那么在创建新数据库或导入现有数据库之前,更改MySQL用户名和密码非常重要。

To create a new database, login to the cPanel dashboard of your WordPress hosting account and click on the MySQL Databases icon.

要创建新数据库,请登录到WordPress托管帐户的cPanel仪表板,然后单击“ MySQL数据库”图标。

MySQL Databases in Cpanel

Next, you will be asked to provide a name for your database and then click on the ‘Create Database’ button.

接下来,将要求您提供数据库名称,然后单击“创建数据库”按钮。

Create new database

After creating the new database, you need a MySQL user associated with that new database. Scroll down to the MySQL users section and add a new user.

创建新数据库后,需要与该新数据库关联MySQL用户。 向下滚动至“ MySQL用户”部分,然后添加一个新用户。

Add new database user

Next, you need to add this user to the MySQL database. Scroll down to ‘Add user to database’ section and select the user along with the database from the drop down menus and then click on the add button.

接下来,您需要将此用户添加到MySQL数据库。 向下滚动到“将用户添加到数据库”部分,然后从下拉菜单中选择用户以及数据库,然后单击添加按钮。

Add user to db

Now your new database is ready. You can use it to restore your WordPress database backup.

现在您的新数据库已准备就绪。 您可以使用它来还原WordPress数据库备份。

Head over to the cPanel dashboard again and then click on the phpMyAdmin icon.

再次转到cPanel仪表板,然后单击phpMyAdmin图标。

Launch phpMyAdmin

Next, you need to click on your new database name and then click on the import button.

接下来,您需要单击新的数据库名称,然后单击导入按钮。

Importing your database

Click on ‘choose file’ button to select your WordPress database backup file and then click on the go button at the bottom of the page to continue.

单击“选择文件”按钮以选择WordPress数据库备份文件,然后单击页面底部的“继续”按钮以继续。

PhpMyAdmin will now upload your backup and import it into your database.

现在,PhpMyAdmin将上传您的备份并将其导入数据库。

You will see a success message upon completion.

完成后,您将看到一条成功消息。

That’s all. You have successfully imported your WordPress database. Now the next step is to install WordPress using your new database. If you have already installed WordPress, then add your new database settings into your wp-config.php file, and you will be good to go.

就这样。 您已成功导入WordPress数据库。 现在,下一步是使用新数据库安装WordPress 。 如果您已经安装了WordPress,则将新的数据库设置添加到wp-config.php文件中 ,一切都会好起来的。

使用cPanel恢复WordPress数据库备份 (Restoring WordPress Database Backup using cPanel)

If you manually created a WordPress database backup using the cPanel on your shared hosting, then you can also restore that database using cPanel.

如果您在共享主机上使用cPanel手动创建了WordPress数据库备份,则还可以使用cPanel还原该数据库。

Log into your cPanel account and under the files section click on Backup.

登录到您的cPanel帐户,然后在“文件”部分下,单击“备份”。

Backup in cPanel

On the backups page, scroll down to ‘Restore a MySQL database backup’.

在“备份”页面上,向下滚动到“还原MySQL数据库备份”。

Next, click on the choose file button and select the backup file from your hard disk. Once done, click on the upload button.

接下来,单击选择文件按钮,然后从硬盘中选择备份文件。 完成后,单击上载按钮。

Restore database using cPanel
使用FTP手动还原WordPress文件 (Manually Restoring WordPress Files using FTP)

If you are restoring WordPress to clean up a hacked site, then you first need to delete all existing WordPress files and directories.

如果要还原WordPress以清理被黑的网站,则首先需要删除所有现有的WordPress文件和目录。

Only do this if your backup is upto date, and you have everything customized, changed, or uploaded on your website.

仅当备份是最新的并且您已自定义,更改或上载了所有内容后,才执行此操作。

If you have all your uploads and customizations, then you can safely delete everything on your website using cpanel (way faster) or using FTP.

如果您具有所有上传和自定义设置,则可以使用cpanel(更快)或使用FTP安全删除网站上的所有内容。

To delete all files from your website, login to the cPanel of your hosting / VPS hosting and under files section click on the file manager icon.

要从您的网站删除所有文件,请登录到托管/ VPS托管的cPanel,然后在“文件”部分下,单击文件管理器图标。

File manager in cPanel

Go ahead and choose Web root as your directory and proceed. File manager interface will now open in a new browser tab. You will need to select all WordPress files and delete them. This way is much faster.

继续,选择Web root作为您的目录并继续。 文件管理器界面现在将在新的浏览器选项卡中打开。 您将需要选择所有WordPress文件并将其删除。 这种方式要快得多。

You can also delete files using FTP, but it’s slower. Simply connect to your website using an FTP client and select all files in your WordPress root directory to delete them.

您也可以使用FTP删除文件,但速度较慢。 只需使用FTP客户端连接到您的网站,然后选择WordPress根目录中的所有文件即可将其删除。

Delete old WordPress files

Next, you need to download a fresh copy of WordPress from WordPress.org and extract it to your hard disk.

接下来,您需要从WordPress.org下载WordPress的新副本并将其提取到硬盘上。

Launch your FTP client and then upload all WordPress files to your server.

启动您的FTP客户端,然后将所有WordPress文件上传到您的服务器。

Upload WordPress files

Once you have uploaded WordPress files, you can upload wp-config.php file from your backup (only if you are sure that it is clean and not compromised).

一旦上传了WordPress文件,就可以从备份中上传wp-config.php文件(仅当您确定它是干净的且没有受到破坏时)。

Alternately, you can rename wp-config-sample.php file in your freshly uploaded WordPress files to wp-config.php file. After that you will need to edit wp-config.php file and enter your database information.

或者,您可以将新上载的WordPress文件中的wp-config-sample.php文件重命名为wp-config.php文件。 之后,您将需要编辑wp-config.php文件并输入数据库信息。

Don’t forget to save the file and upload it back to your website.

不要忘记保存文件并将其上传回您的网站。

Next, you need to upload other files from your backup. We will recommend that you only upload your images in /wp-content/uploads/ directory.

接下来,您需要从备份中上传其他文件。 我们建议您仅将图像上传到/ wp-content / uploads /目录中。

Once you have uploaded these, visit your website to check that everything is working fine.

上传这些文件后,请访问您的网站以检查一切是否正常。

Next, you need to login to your WordPress admin area and start installing plugins you had on your site.

接下来,您需要登录到WordPress管理区域并开始安装您在站点上拥有的插件

Now you can move on to install your theme. If you had customized your WordPress theme or were using a child theme, then you can restore it from backup. However, make sure that those files are clean.

现在您可以继续安装主题了 。 如果您已自定义WordPress主题或使用子主题,则可以从备份中还原它。 但是,请确保这些文件是干净的。

Lastly, go to Settings » Permalinks and adjust permalinks settings to match your site and then update permalinks.

最后,转到“设置”»“永久链接”,并调整永久链接设置以匹配您的站点,然后更新永久链接。

对WordPress备份还原问题进行故障排除 (Troubleshooting WordPress Backup Restore Issues)

There are some common problems that you may come across when restoring your WordPress website. We have separate guides for each of them.

恢复WordPress网站时可能会遇到一些常见问题。 我们每个人都有单独的指南。

还原WordPress网站后要做的事情 (Things to do After Restoring your WordPress Site)

Once you have successfully restored your website, we strongly recommend that you improve your website security.

成功还原网站后,强烈建议您提高网站安全性。

If you haven’t done so already, please make sure that you have a regular WordPress backup with one of these WordPress backup plugins.

如果您尚未执行此操作,请确保使用这些WordPress备份插件之一进行常规WordPress备份。

For securing your website, we will recommend that you immediately change your WordPress password. If you are running a multi-user website, then ask all users to update their passwords immediately.

为了保护您的网站,我们建议您立即更改WordPress密码。 如果您正在运行一个多用户网站,则要求所有用户立即更新其密码

You can also install a website firewall. At WPBeginner, we use Sucuri to monitor and strengthen security of our website. It monitors for security threats, and they also offer malware removal service with their subscription plans. See how Sucuri helped us block 450,000 attacks in 3 months.

您也可以安装网站防火墙。 在WPBeginner,我们使用Sucuri监视和增强我们网站的安全性。 它监视安全威胁,并且还提供其订购计划中的恶意软件清除服务。 了解Sucuri如何帮助我们在3个月内阻止450,000次攻击

We hope this article helped you learn how to restore WordPress from backup. You may also want to see our ultimate step by step WordPress security guide for beginners.

我们希望本文能帮助您学习如何从备份中还原WordPress。 您可能还想看看我们针对初学者的终极逐步WordPress安全指南

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

如果您喜欢这篇文章,请订阅我们的YouTube频道 WordPress视频教程。 您也可以在TwitterFacebook上找到我们。

翻译自: https://www.wpbeginner.com/beginners-guide/beginners-guide-how-to-restore-wordpress-from-backup/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值