Create a new WordPress admin user using phpMyAdmin
Have you ever been locked out of your WordPress admin panel? Whether it’s due to a forgotten password or an unexpected issue, losing access can be incredibly frustrating. Fortunately, there’s a reliable solution: you can create a new admin user directly in your site’s database using phpMyAdmin. This guide will walk you through the process.
Step 1: Access phpMyAdmin
First, log into your web hosting control panel and open phpMyAdmin. Then, select the database associated with your WordPress site. If you’re unsure of the database name, you can find it in the wp-config.php file in your WordPress root directory.
Step 2: Add a new user to the wp_users table
Open phpMyAdmin and navigate to the wp_users table.
In the wp_users table, navigate to the ‘Insert’ tab.
The essential fields to fill are:
user_login: Choose a new admin username.
user_pass: Set a password and select MD5 in the functions menu to encrypt it.
user_email: The email address for the new admin account.
user_registered: Date and time of registration.
user_status: Set this to 0.
Here’s what it looks like:
You can leave the other fields empty.
Once you’ve filled in the necessary fields, scroll down and click on ‘Go’.
After clicking ‘Go’, a confirmation screen will appear. Revisit the wp_users table to locate your new user, and note the value in the ID column for the next step.
Step 3: Assign Admin Capabilities in the wp_usermeta Table
To complete the process, navigate to the wp_usermeta table and select ‘Insert’. Note that the “wp_” prefix might be different in your setup, so look for [your_prefix]_usermeta.
Then, fill in the following values:
user_id: Enter the ID of the user you created in the previous step.
meta_key: Type in wp_capabilities (if your table’s prefix differs from “wp_”, replace it accordingly, like this: [your_prefix]_capabilities).
meta_value: Set the value to a:1:{s:13:”administrator”;s:1:”1″;}
Click ‘Go’ to complete the user meta creation. You can now log into your WordPress site using the credentials set up in Step 3.
Conclusion: By following these steps, you can effortlessly add a new admin user to your WordPress site via phpMyAdmin, bypassing the need for admin panel access. This method is invaluable for regaining control of your website in various situations. Always remember to keep your credentials secure and regularly back up your site to prevent potential issues.