Introduction
If you are unable to access the WordPress dashboard or need to create a new administrator account manually, you can add a WordPress admin user directly through the database using phpMyAdmin. This method allows you to regain access to your website without using the WordPress login page.
Prerequisites
Before proceeding, ensure you have the following:
- cPanel account credentials.
- The username you want to create.
- The WordPress database name.
Implementation:
Step 1: Log into the cPanel account
Step 2: Go to the “Database” section and click on the PHPMyAdmin icon.
Step 3: Select your WordPress database from the list of databases in PhpMyAdmin.
Step 4: Go to the WP Users table and click on the “insert” link.
Step 5: You will need to fill in the necessary fields to insert a new user record.
Step 6: The final step is where we will assign some user meta values to the user account we just created.
Go to the “wp_usermeta” table and click on the “insert” link
Step 7: Use the following values and click the “Go” button to insert the user meta data.
unmeta_id – Leave it blank (it will be generated for you)
user_id – This is the ID of the user we created in the previous step.
meta_key – Use wp_capabilities
meta_value – Use the following value for this field:
a:1:{s:13:”administrator”;s:1:”1″;}
Step 8: Now log into your WP site using this newly created WP User account.
Conclusion
Creating a WordPress administrator account through phpMyAdmin is a useful recovery method when access to the WordPress dashboard is unavailable. By manually adding a user and assigning administrator privileges, you can quickly regain control of your website.