In this tutorial we will show you How to Add an Admin User to WordPress via MySQL/phpMyAdmin.

When you are working with WordPress, there can be some times when you seem to be locked out of your own account. This can happen because of a lot of different things including hacking, accidental admin account deletion.

If you get locked out of your own account because of any reason then you will have to create a new admin account so that you can regain access to your WordPress account.

This is a complete guide where we will be discussing how anyone can add an admin user to the WordPress database via MySQL. Let us now get started.

Creating a new admin account via MySQL

Creating a new admin account via MySQL is a bit complex procedure but we have made it easier for you by dividing the complete procedure into simple steps. You can follow these simple steps to regain access to your WordPress account.

Step 1. Log in to cPanel using your credentials and click on the PHPMyAdmin icon that is there in the Databases section.

Step 2. Then, you will have to select your WordPress database from the list that you see in PhpMyAdmin. After selecting it, click on the “insert” link option in the WP Users table.

Step 3. In order to insert a new user record, you will have to fill in the following fields:

  • ID- Do not fill anything in this field because it will automatically fill it.
  • User_login- Enter your username in this field.
  • User_pass- Enter a password for your account here in this field. Also, make sure to select MD5 in the functions tab.
  • User_nicename- Keep this field empty
  • User_email- Enter your email ID in this field.
  • User_url- Keep this field empty
  • User_registered- Add the date and time in this field.
  • User_status- Add 0 in this field.
  • Display_name- Keep this field empty

After filling all these details, just click on the Go button and you will see a success message.

Step 4. The last step is to add some user meta values to the user account that you just created. You can do this by clicking on the “insert” tab in the “wp_usermeta” table.

Again, you will have to fill in the following fields:-

  • Unmeta_id- Keep this field empty
  • User_id- Enter the ID of the user that you created in the previous step.
  • Meta_key- Use wp_capabilities
  • Meta_value- Fill in the following value in this field.


Once you have filled in details in all the fields then all you need to do is to click on the Go button.

This was it! You are now all set to log into your WordPress account your new admin account. Just fill in the credentials that you added in Step 3 and you will be logged in to your WordPress account.

Summing Up:

This was the complete guide of adding an Admin user to the WordPress Database via MySQL or phpMyAdmin. You can leave your queries or doubts in the comments section below.

Previous ArticleNext Article

Leave a Reply

Your email address will not be published.