Have you ever been in a situation where you got locked out of your WordPress site and you can’t use the reset password because you’re not getting the reset email delivered to your inbox?

In this article, we will go step by step guide on how to create an Admin User in WordPress Database via phpMyAdmin and MySQL.

1.  First of all you need to login to phpMyAdmin 

Admin User

2. Locate your WordPress Database and navigate to wp_users table and click on insert.

Admin User

3. Insert the new admin user’s details in the wp_users Table. In the insert form add the following details:

ID –  Leave this field empty (system will automatically assign the correct value for it)
user_login – insert the desired username you want to use to access the WordPress Dashboard.
user_pass – Insert the desired password for this username. Make sure to select MD5 in the functions menu (Refer to the screenshot below).
user_nicename – Add a desired nickname that you would like to refer yourself as.
user_email – add the desired email you want to associate with this user account .
user_url – add 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 – Add the desired name you like to display for this user on the website ( you can set this to your user_nicename value as well).
Then click on the Go Button

Now go back to the wp_users table and browser the entries to verify that the user record has been inserted successfully.

Take note of the value in the “ID” field for this newly created user (we will need this ID field’s value for the next step). In this case the ID value is 2.

4. Now go to wp_usermeta and click on Insert to add some user meta values to the newly created user account.

Add the following information to the insert form:

unmeta_id – leave this blank (it will be auto-generated)
user_id – this will be the id of the user you created in the previous step. Remember we picked 4.
meta_key – this should be wp_capabilities
meta_value – insert this: a:1:{s:13:”administrator”;s:1:”1″;}

Insert another row with the following information:

unmeta_id – leave this blank (it will be auto-generated)
user_id – this will be the id of the user you created in the previous step. Remember we picked 4.
meta_key – this should be wp_user_level
meta_value – 10

Then click on go and you’ve got yourself a new admin user. Now you can login to your wordpress admin panel with the username and password you’ve specified for this user.  Once logged in, click on Users and edit the user you just created. Scroll all the way down and click on Save button (you don’t need to change anything). This will allow WordPress to go through the properties for this user and add some more information and clean-up the user we just added.

SQL query:

This process is for developers who wants to speed up the process. Just copy the following snippets of sql code and replace them with appropriate information and you will have yourself a new admin user in no time.

INSERT INTO `databasename`.`wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES ('4', 'demo', MD5('demo'), 'Your Name', 'test@yourdomain.com', 'http://www.themelines.com/', '2011-06-07 00:00:00', '', '0', 'Your Name');


INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '4', 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');


INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '4', 'wp_user_level', '10');

 

Leave a Reply

Or

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


CAPTCHA Image
Reload Image

Find us on Facebook

Subscribe to our Newsletter