私たちは常に、WordPressの完全なバックアップを定期的に取ることをユーザーに推奨しています。しかし、データベースのバックアップしかとらない無料プラグインを知らずに使っていたらどうなるでしょうか?この投稿では、データベースのバックアップだけでWordPressサイトを復元する方法を紹介します。完全な復元にはなりませんが、被害を最小限に抑える方法をご紹介します。
はじめに
このチュートリアルでは、WordPressデータベースのバックアップがzipファイルに保存されていることを前提としています。まだお持ちでない場合は、WordPressデータベースのバックアップを手動で作成する方法をご覧ください。
ウェブホスティングサービスでの嫌な経験から立ち直りつつあるのであれば、より良いホスティングサービスを見つける時でしょう。私たちは最高のWordPressホスティングサービスプロバイダーを厳選しました。これらは、私たち自身のプロジェクトで一緒に働き、信頼できる会社です。
こちらもご覧ください:WordPressホスティングサービスを切り替えるべき7つの重要な指標。
WordPressデータベースのバックアップを復元する準備
まず、新しいデータベースを作成する必要があります。cPanelアカウントにログインし、データベースセクションのMySQLデータベースをクリックします。
次に、データベースの名前をプロバイダーで指定し、データベースの作成ボタンをクリックします。
データベースを作成したので、新しく作成したデータベースで作業するためのすべての権限を割り当てる MySQL ユーザーが必要です。
同じMySQLデータベースページで、MySQLユーザーセクションまでスクロールダウンし、新規ユーザーを追加する。
データベース・ユーザーのユーザー名と強力なパスワードを入力し、ユーザー作成ボタンをクリックします。
次に、このユーザーを MySQL データベースに追加する必要があります。Add user to database」セクションまでスクロールダウンし、ドロップダウンメニューからデータベースとともにユーザーを選択し、追加ボタンをクリックします。
これで、WordPress用の新しいデータベースの準備が整いました。
WordPressデータベースのバックアップをインポートする
まず、cPanelのダッシュボードにアクセスする必要があります。データベースセクションで、phpMyAdminをクリックします。
次のステップで、phpMyAdminページで作成したデータベースを選択し、インポートボタンをクリックします。
ここで、WordPressデータベースのバックアップファイルをアップロードするために、ファイルを選択するボタンをクリックする必要があります。ページの下にあるgoボタンをクリックするだけで、インポートが開始されます。
インポートが完了すると、成功のメッセージが表示されます。
これでWordPressデータベースのインポートは成功です。次のステップは、新しいデータベースを使用してWordPressをインストールすることです。
WordPressサイトの復元
WordPressを手動で復元するには、サーバーにWordPressを手動でインストールする必要があります。ステップバイステップのWordPressインストールチュートリアルをご覧いただき、「FTPを使用してWordPressをインストールする方法」のセクションにジャンプして、詳しい手順をご覧ください。
インストール中、「設定ファイルを作成する」ステップに到達したら、次のように入力します。先ほど作成したデータベース名とユーザーを入力してください。
WordPressがデータベースに接続できるというメッセージが表示されるので、これでインストールを実行できます。
インストールボタンをクリックすると、「すでにインストールされています」というメッセージが表示されます。
これで、WordPressサイトへのログインはすべて完了です。
復旧トラブルシューティング
古いWordPressファイルがないため、いくつかのものが欠けています。簡単に復元できるものもあれば、少し難しいものもあります。すべて一つずつ見ていきましょう。
1.テーマ
古いWordPressテーマの新しいコピーをインストーラするだけです。テーマファイルに直接変更を加えた場合、その変更はすべてなくなります。
テーマオプションから以前のように設定する必要があります。
2.ウィジェット
ウィジェットはWordPressテーマにおいて重要な権限グループです。幸いなことに、ウィジェットはWordPressのデータベースに保存されており、古いテーマに切り替えるとウィジェットの一部が復元されます。
いつでも外観 ” ウィジェットでサイドバーにウィジェットを追加したり並べ替えたりすることができます。
WordPressプラグインには独自のウィジェットが付属しているものがあります。それらのウィジェットを使用するには、まずそれらのプラグインをインストールして有効化する必要があります。
3.パーマリンク
サイトのパーマリンク構造もデータベースに保存されており、自動的に復元されます。しかし、サイトのフロントエンドで404エラーが表示される場合は、パーマリンクの設定を更新する必要があります。
設定 ” パーマリンクに行き、何も変更せずに変更を保存ボタンをクリックするだけです。これでWordPressのURL構造が更新されます。
4.プラグイン
WordPressはあなたのサイトの有効化したプラグインの記録を保存します。初めてプラグインページにアクセスすると、WordPressはデータベースにあったが今はインストールされていない各プラグインのエラーリストを表示します。
プラグイン名をすべてコピーし、1つずつインストールして有効化してください。
WordPressサイトで失われた画像を復元する
サイト上で失われた画像を見つけ、置き換えることは、復旧作業の中で最も厄介な部分です。コンテンツや画像の量にもよりますが、長い時間がかかります。
残念ながら、簡単な方法はありません。さまざまなツールを使って、さまざまなソースから画像を抽出する必要があります。すべての画像を復元できる可能性はかなり低いでしょう。
1.ブラウザーキャッシュを見る
最近サイトを失ったのであれば、ブラウザーキャッシュを見ることができます。
FirefoxユーザーはCacheViewer2アドオンをダウンロードすることで、ブラウザーキャッシュに保存されているサイトの画像を簡単に見つけることができます。
画像を右クリックし、メニューから名前を付けて保存を選択するだけです。
WindowsのGoogle Chromeユーザーは、Chrome Cache Viewerをお試しください。
MacのGoogle Chromeユーザーは、運が悪いとしか言いようがありません。MacでGoogle Chromeのキャッシュから画像を閲覧、プレビュー、保存するための合理的な解決策は見つかりませんでした。
2.ウェブキャッシュから画像を探す
サイトのキャッシュを保存しているウェブサービスはいくつかあります。Googleの画像検索で画像を探すことから始めましょう。サイトのURLを入力するだけで、Googleがあなたのサイトで見つけた画像を見ることができます。
画像をクリックすると大きなプレビューが表示され、画像を保存することができます。
かなり古いサイトを修復していて、GoogleやBingで画像が見つからない場合は、Archive.orgを試してみるとよい。Archive.orgは非営利団体で、歴史的な目的でサイトのスナップショットを保存している。
サイト上の画像の検索と置換
旧サイトにあまりコンテンツがない場合、投稿日: の画像を手動で置き換えることができます。しかし、コンテンツが多い場合は、手動で画像を探して置き換えるのは難しいでしょう。
ここでは、壊れた画像を簡単に見つけて置き換える方法をご紹介します。
まず、Broken Link Checkerプラグインをインストールして有効化する必要がある。有効化したら、Tools ” Broken Link Checkerページにアクセスするだけです。プラグインは、あなたのサイト上のすべての壊れたリンクのリストを表示します。
リンク切れの画像もリンク切れとみなされ、リストに表示されます。リンクテキストのカラムをクリックすると、リンク切れリストをソートして画像を最初に表示することができます。
これで、投稿を編集して復元した画像を置き換えることができます。復元できなかった画像については、再作成を試みるか、単にリンクを解除することができます。
ボーナスヒント
失われたデータをすべて回復するのは難しいでしょう。サイトがエラーを表示し、ユーザーエクスペリエンスに影響を与える可能性さえあります。多くの専門家が自動バックアップを設定するよう強く勧めているのはこのためです。
私たちはBackupBuddyの使用をお勧めします。これは、簡単な復元オプションと自動的にクラウド上にバックアップを作成して保存する機能を備えたプレミアムWordPressバックアッププラグインです。
以上、この投稿がデータベースのバックアップから WordPress サイトを復元するのにお役に立てば幸いです。WordPress管理エリアを保護するための13の重要なヒントとハックのリストもご覧ください。
この投稿が気に入った場合は、WordPressの動画チュートリアルをYouTubeチャンネルに登録してください。Twitterや Facebookでもご覧いただけます。
Syed Balkhi says
Hey WPBeginner readers,
Did you know you can win exciting prizes by commenting on WPBeginner?
Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
You can get more details about the contest from here.
Start sharing your thoughts below to stand a chance to win!
Moinuddin Waheed says
Thanks for this guide.
I have a backup from 2016 of one of my blogs and I have tried multiple times not able to restore them back.
I will try these steps and see if I would be able to successfully restore my database.
the thing that I am missing are the posts that I had written on my blog.
hope this will work.
Ruby Yeo says
Hi, please help, the ‘create a configuration file’ part didn’t pop up after successful installation
WPBeginner Support says
You would want to ensure you are using the FTP installation method from our guide below as if you use the built-in methods from hosting providers, they handle that step for you which is why you would not see that page.
https://www.wpbeginner.com/how-to-install-wordpress/#installftp
管理者
Mallory says
Thanks for this article! I restored my site from the database file. But when I visited the plugins page for the first time, I didn’t immediately copy the list of plugin errors from the plugin files that don’t exist any more. Now the notification is gone. Is there any way to find this list again? There were several plugins that I don’t remember but need to be reinstalled.
WPBeginner Support says
Sadly, we do not have a specific location we would recommend for finding the errors again.
管理者
Emmanuelkwofie says
Hi, I was noticed by my hosting company that hackers have back door to my website so I should clean it and didn’t know what to do, so I did a backup of my theme, plugins, and upload and downloaded it to my local pc. I did not also remove the database. so in all, I have my database and the other files I backed up. Please, can I still get my website back and how? i don’t have the htc.access file and the wp.config file. How do i get my website back as it was?
WPBeginner Support says
If the method in this article does not help, you could take a look at our other article here: https://www.wpbeginner.com/beginners-guide/beginners-guide-how-to-restore-wordpress-from-backup/
管理者
Dean says
I ran restore database and let it run for HOURS. All the time it said “loading”. When I went back into cPanel the dbase size is 0.00.
Is there some voodoo magic I can use to restore my database?
WPBeginner Support says
You would want to first reach out to your hosting provider to see if they’re having any issues on their end that could be preventing the restore.
管理者
LibertySky says
Instead of “Already Installed” I have a new clean installation and nothing is restored
WPBeginner Support says
Hello,
Please retry the steps and make sure your database settings are correct.
管理者
eswaran says
i have installed wordpress on server and took backup using this i have created same copy of wordpress in my local machine. I have installed some of plugin on server and restored the plugin physical file via FTP to my locai machine. Then i took DB backup from server and restored in my local machine.
The problem is i have activated the plugin’s on server but after restore database the plugin not active automatically in my locai machine. Every time i need to activate manually.
To achieve this do i need update any sql script on database?
Ronny P. says
Thanks. Site was throwing 404 on all posts, got fixed after updating the permalink setting.
Richard Adarkwah says
This article is great and enabled us to have our website back!
Lisander says
I have an old site I wanted to recover, but my old laptop crashed.
Had an older back up lying around (not the latest). i followed these steps, now I have about 70% restored.
Thanks for the guide.
Mustapha says
Thank you very much,
Restored 90% of my lost template, I worked hard for 2 months to create it.
Many thanx!
zhul says
so what happen with my old article if i restored the new backup from another site?
is it replace all data?
Ahmed LAHMAR says
Thank you WPBeginner,
I went through the same bad experience but luckily my images were stored in the free cdn offered by WordPress.com
Ewan Yates says
Thanks for this great guide. Quick question though,…
When creating a new database and user, do they need to be the same as the ones in the backup?
WPBeginner Support says
No, you can create a new database under a different user.
管理者
Dusty says
This is a great guide for those instances where a full backup isn’t available. Full backups are so important! Thanks!