Create a WordPress Admin User via MySQL
One of our users site got hacked and the WP Admin user account password was changed by the hacker. This essentially locked the user out of his admin dashboard. It is best (for situations like this) to just create a new admin user account to gain access to WP admin dashboard and fix things as needed.
In this tutorial I will show you how you can create a new WordPress admin user account via MySQL database (without having access to your WordPress admin dashboard).
Step 1) Access Your MySQL Database
Log into your cPanel/Control panel
Go to “Database” section
Click on PHPMyAdmin icon
Select your WordPress database from the list of databases in PhpMyAdmin
Go to the WP Users table and click on the “insert” link
You will need to fill in the following fields to insert a new user record:
ID – Keep the value of this field empty (it will automatically assign the correct value for it)
user_login – insert the username you want to use
user_pass – add a password for the account. Select MD5 in the functions menu (Refer to the screenshot below).
user_nicename – leave this field empty for now
user_email – add the email address you want to use for this account.
user_url – leave this field empty for now
user_registered – select the date/time for when this user is registered.
user_status – set this to 0.
display_name – leave this field empty for now
Click on the Go Button (you should see a success message)
This is the final step 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:
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. For our case it is 2.
meta_key – Use wp_capabilities
meta_value – Use the following value for this field:
See screenshot below
Content credit: 3gp mobile movies