How to create an Admin User to the WordPress through MySQL Database using phpMyAdmin

If you lose or forgot the login details of WordPress admin and even don’t know the email address associated with WordPress and not able to regain access, or if the website is hacked and your admin access removed then You need to create another admin user in WordPress Database via MySQL(phpMyAdmin).

So here is the step by step guide on how to create an Admin User to the WordPress MySQL Database through phpMyAdmin.
Please make a backup of your database before performing any edits in the MySQL database. You should have basic knowledge of how phpMyAdmin to create an admin user.

Create a WordPress Admin User in database though phpMyAdmin

First, log in to phpMyAdmin and locate your WordPress database.
If you don’t know the database name you can find it in your wp-config.php file.
In the Database, we need to insert values in wp_users and wp_usermeta tables (The tables prefix “wp_” may be different in your case)
Now click on the Insert tab as it shows in the image below

create-an Admin User-to the WordPress MySQL Database through phpMyAdmin1

Now insert the data

ID – Pick a number (for example, I used the number 3).user_login – Enter the username you want to use to access the WordPress Dashboard.
user_login – Enter the username.
user_pass – Enter the password and Make sure to select MD5 in the Function column as shown in the screenshot below.
user_nicename – You can enter your name here.
user_email – Enter your email you want to associate with this account.
user_url – this would be the url to your website.
user_registered – select the date/time for when this user is registered.
user_status – set this to 0.
display_name – put the name you like to display for this user on the site (it can be your user_nicename value as well).

Click on the Go Button

create an Admin User to the WordPress MySQL Database through phpMyAdmin

Next, go to wp_usermeta table then click on the Insert tab just like the previous step.
Then enter the information to the form as follows:

unmeta_id – leave this blank as it’s auto-generated
user_id – this is the id of the user you created in the previous step. I picked 3.
meta_key – this should be wp_capabilities (use your tables prefix, if it is not “wp_”)
meta_value – insert this: a:1:{s:13:”administrator”;b:1;}

add one more row with the following information:
unmeta_id – leave this blank (it will be auto-generated)
user_id – this is the id of the user you created in the previous step. I picked 3.
meta_key – this should be wp_user_level (use your tables prefix, if it is not “wp_”)
meta_value – 10

Then click on the Go button.

It’s done, now you created your self a new admin user, you can log in to WordPress admin using the username and password you set up in the database.

Wasim

Wasim Sama is a passionate blogger and experienced web developer.

Leave a Reply

Your email address will not be published. Required fields are marked *

More in Wordpress
Reverse Column Order in Visual Composer or WPBakery
How to Reverse Column Order in Visual Composer or WPBakery

If you are using Visual Composer or WPBakery page builder and wondering to create a two columns section like 1st

Close