0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Wordpress 管理画面に入れない時データベース(phpMyAdmin)から管理者ユーザーを強制追加

Last updated at Posted at 2026-01-09

手順①:phpMyAdmin に入る

Local を使っている場合:

Local → 対象サイト → Database → Open Adminer or phpMyAdmin

サーバーの場合:

サーバー管理画面 → phpMyAdmin

手順②:WordPress のデータベースを選択

① wp_users テーブルを開く

(※ wp_ は環境によって違う場合あり)

② 「SQL」タブをクリックして、以下を そのまま実行

SQL文
INSERT INTO wp_users
(user_login, user_pass, user_nicename, user_email, user_status, display_name)
VALUES
('admin_recovery',
 MD5('TempPass12345!'),
 'admin_recovery',
 'admin@example.com',
 0,
 'Admin Recovery');

これで
ユーザー名:admin_recovery
パスワード:TempPass12345!
が作成されます(※後で必ず変更してください)

手順④:管理者権限を付与(wp_usermeta)

wp_usermeta テーブルを開く

同じく「SQL」タブで以下を実行

SQL文
INSERT INTO wp_usermeta (user_id, meta_key, meta_value)
VALUES
((SELECT ID FROM wp_users WHERE user_login = 'admin_recovery'),
 'wp_capabilities',
 'a:1:{s:13:"administrator";b:1;}');

続けて もう1つ実行

SQL文
INSERT INTO wp_usermeta (user_id, meta_key, meta_value)
VALUES
((SELECT ID FROM wp_users WHERE user_login = 'admin_recovery'),
 'wp_user_level',
 '10');

wp_ が違う場合(例:wp123_)
→ wp_capabilities → wp123_capabilities
→ wp_user_level → wp123_user_level

に書き換えてください。

手順⑤:管理画面にログイン

/wp-admin/

ユーザー名:admin_recovery

パスワード:TempPass12345!

👉 ここで入れたら成功

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?