Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPBカップ
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

WordPressデータベースを初期設定に戻す方法

編集メモ: WPBeginner のパートナーリンクから手数料を得ています。手数料は編集者の意見や評価に影響を与えません。編集プロセスについて詳しく知る。

WordPressデータベースを元の設定にリセットしますか?

ローカルサーバーやテストサイトで作業している場合、データベースを最初に開始したときの状態に戻す必要があるかもしれません。

この投稿では、WordPressのデータベースを数クリックで初期設定にリセットする方法をご紹介します。

Reset WordPress database to fresh install

このチュートリアルで説明するステップの概要を簡単に説明します:

WordPressデータベースを初期設定に戻す理由

このチュートリアルは、非本番サイト(未公開サイト)で作業しているユーザー向けです。

WordPressユーザーの多くは、WordPressサイトをライブサーバーにアップロードする前に、まずローカルコンピューターで作業を行います。

同様に、開発モードやステージング・モードのサイトで作業するユーザーもいる。

この開発プロジェクトでは、サイトをテストするためにダミーデータを追加する必要があるかもしれません。また、さまざまなプラグインやテーマを設定し、試してみることもあるでしょう。これらのサイトはライブではなく、一般公開されていないため、そうすることは安全です。

この開発中に、WordPressのデータを空の状態にリセットしたくなるかもしれません。

一つの方法は、追加したものをすべて削除することだ。これは時間がかかるし、追加したものすべてを覚えていないかもしれない。

2つ目のオプションは、プラグインを使ってデータベースを素早く空にし、初期設定のインストールに戻すことだ。

ということで、WordPressのデータベースを初期設定に簡単にリセットする方法を見ていきましょう。

ステップ1:リセットの前にWordPressのバックアップを準備する

WordPressは、サイトのコンテンツをすべてデータベースに保存します。これには投稿、ページ、メディアファイルのデータ、プラグインやテーマの設定などが含まれます。

ローカルサーバー上のテストサイトやステージングサイトで作業していた場合、インストーラをリセットして最初からやり直したくなることがあります。

WordPressデータベースのリセットは、これを行う最速の方法です。Webホスティングサーバーに保存されているファイルを削除することなく、WordPressのデータをすべて削除します。

しかし、WordPressのデータベースをリセットしてしまうと、データはすべて永久に消えてしまいます。元に戻すことはできません。

先に進む前にWordPressの完全なバックアップを取ることをお勧めします。サイト全体をバックアップしたくない場合は、WordPressデータベースだけをバックアップすることもできます。

では、リセットの前にWordPressデータベースを素早くバックアップする2つの方法をご紹介します。あなたに最適な方法を選んでください。

方法1:Duplicatorを使ってWordPressデータベースをバックアップする

Duplicatorは市場で最高のWordPressバックアッププラグインです。WordPressサイトを簡単にバックアップし、バックアップから素早く復元することができます。

まず、Duplicatorプラグインをインストールして有効化する必要があります。詳しくは、WordPressプラグインのインストール方法のステップバイステップガイドをご覧ください。

注: Duplicatorには無料版もあります。しかし、プラグインの可能性を最大限に引き出すには、有料プランへのアップグレードをお勧めします。

有効化した後、Duplicator ” Packagesページに行き、’Create New’ ボタンをクリックします。

Create new duplicator package

次に、バックアップの名前を指定する必要があります。

Next(次へ)」ボタンをクリックして進みます。

Duplicator making a backup step 1

DuplicatorはWordPressサイトをスキャンし、スキャン結果を表示します。

WordPressのセキュリティ・プラグインがインストールされていない場合や、古いバージョンのWordPressを使用している場合など、いくつかの通知が表示されることがあります。

これらの通知は無視して構いません。他に問題がなければ、’Build’ボタンをクリックして続行する。

Build Duplicator package

プラグインはWordPressデータベースをバックアップし、ダウンロードオプションを表示します。

ダウンロード」と「両方のファイル」ボタンをクリックしてください。

Download package files

Duplicatorはアーカイブとインストーラのファイルをコンピューターにダウンロードします。

方法2:Advanced WP Resetを使ってデータベースのバックアップを作成する

この方法では、Advanced WP Resetプラグインを使用します。これは、次のステップでWordPressデータベースをリセットするために使用するのと同じプラグインです。

しかし、このバックアップ方法の欠点は、phpMyAdminを使用してWordPressデータベースを復元しなければならないことです。

まず、Advanced WP Resetプラグインをインストールして有効化する必要があります。詳しくは、WordPressプラグインのインストール方法のステップバイステップガイドをご覧ください。

有効化したら、ツール ” アドバンスドWPリセットのページに行き、「スナップショット」タブに切り替える。

Make database backup with Snapshots tool

バックアップの名前を入力し、’Take Snapshot’ボタンをクリックします。

プラグインがデータベースのコピーを作成し、バックアップとして保存します。利用可能なスナップショット」セクションに表示されます。

Available snapshots

しかし、WordPressデータベースをリセットすると、プラグインはこのスナップショットも削除します。後で使うにはコンピューターに保存する必要があります。

プラス[+]アイコンをクリックしてスナップショットオプションを展開し、「ダウンロード」ボタンをクリックします。

Download backup file

データベースのバックアップがSQLファイルとしてコンピューターにダウンロードされます。

ステップ2:WordPressデータベースを初期設定に戻す

次に、Advanced WP Resetプラグインをインストールして有効化する必要があります。詳しくは、WordPressプラグインのインストール方法のステップバイステップガイドをご覧ください。

次に、ツール ” アドバンスドWPリセットのページに行き、「リセット」タブに切り替える。

Items that will be deleted

サイトリセットセクションでは、プラグインがリセットするすべてのデータが表示されます。これには以下が含まれます:

  • ページ、投稿、コメントする
  • カスタマイザー・データベース・テーブル(お客様またはサイトにインストールされたWordPressプラグインによって作成されたもの)
  • 現在の管理ユーザー以外のユーザー
  • 高度なWPリセットプラグインデータ(スナップショットや設定を含む)

その下に、削除されないデータが表示されます。これには以下の項目が含まれます:

  • 管理ユーザーアカウント
  • ファイル、メディアライブラリのアップロード、テーマ、プラグインなど。ただし、データベースに保存されているプラグインやテーマのデータは削除されます。
  • サイトタイトル、WordPressアドレス、サイトアドレス、タイムゾーン、言語オプションなど、WordPressの基本設定
  • WordPress以外のデータベーステーブル。これらのテーブルは、WordPressデータベース設定で設定されたテーブル接頭辞を共有しません。

問題がなければ、「警告」ラベルの下に「リセット」と入力し、「リセット」ボタンをクリックする。

Type reset to run the reset command

これでまたポップアップ警告が表示される。

今すぐリセット」ボタンをクリックしてください。

Reset warning

プラグインはWordPressデータベースを初期設定にリセットします。

完了すると、成功のメッセージが表示されます。

WordPress database reset finished

これで、初期設定のデータベース設定でサイトを使い続けることができます。

注: リセットすると、プラグインはWordPressの初期設定コンテンツを再作成します。これには、「Hello World」というタイトルのブログ投稿、「ページ」の下の「サンプルページ」、「コメント」の下のサンプルコメントが含まれます。これらを手動で削除してください。

ステップ3:バックアップからWordPressデータベースを復元する(オプション)

何らかの理由でWordPressデータベースを初期設定にリセットしてもうまくいかなかった場合は、最初のステップで作成したバックアップからデータベースを復元することができます。

方法1:Duplicatorデータベースバックアップを復元する

Duplicatorプラグインを使用してWordPressデータベースのバックアップを作成した場合、サイトを復元する方法は次のとおりです。

データベースリセットの間、Advanced WP Resetプラグインはサイトにインストールされている他のWordPressプラグインをすべて無効化します。

WordPress管理エリアのプラグインページに移動し、Duplicatorプラグインを有効化します。

Activate Duplicator plugin

プラグインを有効化したら、Duplicator ” インポートページにアクセスしてください。

ここで、最初のステップでダウンロードしたアーカイブファイルをアップロードする必要があります。

Duplicator import

次に、プラグインはアーカイブファイルをスキャンし、パッケージの詳細を表示します。

問題がなければ、「続行」ボタンをクリックしてインポートを開始する。

Import ready

次の画面で、リカバリポイントなしで続行するかどうかの確認を求められることがあります。

すでに最新のバックアップがあるので、リカバリーポイントを作成せずに続行しても安全です。

Recovery point confirmation

ページを一番下までスクロールしてください。

システム概要の下に投稿数、ページ数、コメント数、メディア数が表示されます。インストーラの起動」ボタンをクリックして続行します。

Launch installer

Duplicatorインストーラが起動します。

起動すると、インストーラは自動的に復元タイプとして「個別サイトの復元」を選択します。

Restoration type

Validationセクションまでスクロールダウンする。

ここで再び、回復ポイントに関する警告が表示されます。すべての利用規約と注意事項を読み、同意します」オプションの横にあるチェックボックスをオンにする必要があります。

Accept terms and notices

Next(次へ)」ボタンをクリックして進みます。

Duplicatorがインストーラ設定のポップアップを表示します。OK」ボタンをクリックしてください。

Confirm installation settings

Duplicatorはバックアップからサイトのインポートを開始し、WordPressデータベースを復元します。

完了すると、WordPress管理エリアにログインするためのボタンが付いた成功メッセージが表示されます。

Import finished

方法2:SQLファイルからデータベースバックアップを復元する

Advanced WP Resetプラグインのスナップショットツールを使ってWordPressデータベースの方法を保存した場合、データベースを復元する方法は以下の通りです。

まず、phpMyAdminを開いてください。これはウェブベースのツールで、フレンドリーなインターフェースを使ってデータベース操作を簡単に行うことができます。

保存しようとしているサイトがWebサーバーでホストされている場合は、WordPressホスティングアカウントのコントロールパネル(cPanel)にログインします。

ここからデータベースセクションを探し、「phpMyAdmin」ボタンをクリックします。

Launch phpMyAdmin

新しいブラウザータブでphpMyAdminが開きます。

一方、コンピューター上のローカルサイトで作業していた場合は、ローカルサイトで使用しているソフトウェアからphpMyAdminや同様のツールを開くことができる。

phpMyAdminが付属していないLocalを使用することをお勧めします。代わりに、Open Adminerを使用してデータベースを管理します。

Open Adminer

phpMyAdminに入ったら、サイトのデータベースを選択していることを確認してください。

phpMyAdminのテーブルリストの下にある’Check all’ボックスをクリックして、すべてのデータベーステーブルを選択します。その後、’With selected’ ドロップダウンメニューから ‘Drop’ を選択します。

Drop tables

WordPressのデータベースが空になります。

上部にある「インポート」タブに切り替え、「ファイルを選択」ボタンをクリックして、先ほどダウンロードしたSQLファイルを選択します。

Import SQL file

ファイルを選択した後、画面上のオプションを確認してください。初期設定でほとんどのサイトに対応できます。

ページを下にスクロールし、「インポート」ボタンをクリックします。

Run import

phpMyAdminがSQLファイルをアップロードし、実行します。

その後、成功のメッセージが表示されます。

SQL file imported

これで、サイトにアクセスしてログイン中、データベースが以前の設定に復元されているのを確認できます。

この投稿がWordPressデータベースを初期設定にリセットする方法を学ぶのにお役に立てば幸いです。また、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.

情報開示 私たちのコンテンツは読者支援型です。これは、あなたが私たちのリンクの一部をクリックした場合、私たちはコミッションを得ることができることを意味します。 WPBeginnerの資金源 をご覧ください。3$編集プロセスをご覧ください。

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

究極のWordPressツールキット

ツールキットへの無料アクセス - すべてのプロフェッショナルが持つべきWordPress関連製品とリソースのコレクション!

Reader Interactions

46件のコメント返信を残す

  1. 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!

  2. A Owadud Bhuiyan says

    I have heard that our database will automatically take back up from our hosting.

    How do I find out where is my database backup file?

    • WPBeginner Support says

      It would depend on your hosting provider for if they do that and where the backup would be located. If you reach out to your host they should be able to let you know!

      管理者

    • Jiří Vaněk says

      It’s different for every provider. Backups are usually available in an FTP folder, which is embedded there as a symlink to the backup server. Another option is in the form of a control panel, which is available for the website (but does not have to be). Another possibility is that backups are available from the service administration of your web hosting provider. And the last option is on request. This means that backups are not available, but the provider will provide them to you upon request, or, if it is better and has excellent customer support, it can restore the database directly from the backup. It’s more of a web provider question.

  3. THANKGOD JONATHAN says

    Please if I choose to use the ADVANCE WP RESET plugins to backup my database, can I still use it to restore the database? Because I didn’t hear you mention it.
    And secondly please, if for instance I thing my wordpress site has been compromised can I use this method to remove the maliciouse codes?
    Thank you for considering this question.

  4. Jiří Vaněk says

    Isn’t it easier to delete the database content through PHPmyAdmin? After calling the domain or localhost, a reinstallation will take place, and everything should be reset. The data on FTP will remain, including the folder with plugins, which can simply be activated if necessary.

    Backup DB can be done also in PHPmyAdmin.

    • WPBeginner Support says

      If you are comfortable with using the editing interface then you can use phpmyadmin’s interface but for most beginner users we would recommend the route from our article to prevent accidental deletion of something that they would want to keep :)

      管理者

  5. dai says

    hi there.. i see i face same issue as many others here.
    since i resat it all..i have and error while trying to get to my wordpress page : “Sorry, you are not allowed to access this page.”

    how to fix it up ???
    thanks.

  6. maurice says

    hey I wonder if I have a subdomain such as test.example.com and i reset the whole db with this tool. Will the DB for example.com stay untouched or will this also be resetted?
    Want to reset just the testpage so I can check a new theme but want to leave the live page untouched…
    thx

  7. Villy says

    I used the database reset on my site , and now I can’t log in. I think it’s because I deleted the wP-users file. I tried to change passwords but didn’t receive an email. How do I fix this..

  8. Nathan says

    I used this plugin-in and after I reset everything, my site no longer exist. How do I get it back? I can’t get into my admin permissions.

  9. Gozie Prosper says

    What option can i select so as to reset my WordPress without loosing my users, my plugins and my pages. Even if I loose my themes, I have no issue with it.

    Thanks a lot

  10. Jan says

    Will this delete original blog posts on WordPress? I want to get rid of my duplicates but I do not want to lose my work :(

  11. Louise says

    After reading reams of information which might as well have been written in a foreign language, I came across this and it solved my problem beautifully. Thank you.

  12. Asim Khan says

    Hi i have a problem that when i go to add new post my HTML and Text buttons are hidden and i cannot type my text so plz help me

  13. Mohammed says

    I have reset the wordpress. But now i cant visit my site iam worried if i click on my site its coming white empty pls help

  14. Special says

    Apparently I am a complete idot and I just wiped my clients entire website. Nope, apparently not smart enough to create a back and it is due next week. First big project…I need help….ASAP!!!

  15. Gerrit Smit says

    I have users reset with the plugin, now I can not login to wordpress.

    I get message
    “” You do not have enough rights for this page ‘

    Who can help me please

    thanx

  16. Muhammad Amir says

    it worked .. but once signed out ..unable to login its nt accepting my current password or the 1st one :( ..

  17. stacy says

    Any chance this can be run from a cron job so it’s automated? I’m trying to setup a demo site and would like the content to be reset once an hour.

    On that note, any ideas on how to get the wordpress site to also delete any new images that were uploaded during that time?

    Thanks for your help!

  18. Joseph says

    Hi, really cool post but I do have a question…will this affect my themes? I have some premium themes i don’t want to lose.

  19. Zaadu says

    Thanks for this! All the times before I used to make changes to the db and make anew install of wordpress…No more from now on

返信を残す

コメントありがとうございます。すべてのコメントは私たちのコメントポリシーに従ってモデレートされ、あなたのメールアドレスが公開されることはありませんのでご留意ください。名前欄にキーワードを使用しないでください。個人的で有意義な会話をしましょう。