Creating WordPress admin user in MySQL using phpMyAdmin
If you’ve lost access to your WordPress administrator account, you can create a new admin user directly in the database using phpMyAdmin. On ruachost.com, this method bypasses the WordPress dashboard and gives you immediate access.
Why Use phpMyAdmin?
Section titled “Why Use phpMyAdmin?”- Recover access if your admin login is lost or corrupted.
- Create emergency admin accounts without reinstalling WordPress.
- Manage users directly at the database level.
Steps to Create an Admin User in phpMyAdmin
Section titled “Steps to Create an Admin User in phpMyAdmin”-
Log in to cPanel (or your hosting control panel).
-
Go to the Databases section → Click phpMyAdmin.
-
Select your WordPress site’s database from the left sidebar.
- Look for the table named
wp_users(prefix may vary, e.g.,wpem_users).
- Look for the table named
-
Click the Insert tab.
-
Fill in the form:
- user_login → Desired username (e.g.,
newadmin). - user_pass → Enter a password and select MD5 in the Function dropdown.
- user_email → Your email address.
- user_registered → Current date/time.
- user_status → Set to
0.
- user_login → Desired username (e.g.,
-
Click Go → The new user will be added.
⚙️ Assigning Admin Privileges
Section titled “⚙️ Assigning Admin Privileges”-
In the same database, open the table
wp_usermeta(or[prefix]_usermeta). -
Click the Insert tab.
-
Fill in the form:
-
user_id → The ID of the user you just created (from
wp_users). -
meta_key →
wp_capabilities(or[prefix]_capabilities). -
meta_value →
a:1:{s:13:"administrator";s:1:"1";}(For some prefixes, use
a:1:{s:13:"administrator";b:1;})
-
-
Click Go → This grants administrator rights.
Important Notes
Section titled “Important Notes”- Always back up your database before making changes.
- Ensure you use the correct table prefix (it may differ for security reasons).
- After creating the user, log in via the WordPress admin login page with the new credentials.