How to Add an Admin User to a WordPress Database

Under normal circumstances, if you have lost access to the WordPress administration area, you can simply use WordPress’ password recovery feature to reset your password. However, there are some cases when this isn’t possible.1 Fortunately, if you can access the database directly, it is easy to add an admin user.

This tutorial will show you how to manually add an admin user via phpMyAdmin.2

Step 1: Log into phpMyAdmin & Locate The Database

If you have FTP access, the quickest way to retrieve the database details is by opening up the wp-config.php file located at the root of the WordPress installation.3 However, if you do not have access to this file, you can log into phpMyAdmin and verify that you are looking at the proper database by matching the site urls in the wp_options table.

Step 2: Add a User to the wp_users Table

WordPress Tables in phpMyAdmin

You will now need to add a new user. On most installations, the table that you need to find is wp_users, as shown in the image at left.4 To get to the table, just click on the table’s name.phpMyAdmin Insert Tab

 Next, click on the Insert tab. (You will find the insert tab in the horizontal list of links located across the top of the page. See the image at left.) This will bring up an insert form which will allow you to add new values to the table.

 Now, enter following information in the fields:

  1. ID – leave blank (this is automatically generated)
  2. user_login – enter desired user WordPress username
  3. user_pass – enter desired user password (be sure to select MD5 from the phpMyAdmin Function dropdown menu)
  4. user_nicename – enter a name or an alias, do not enter the user login name
  5. user_email – enter an email address for the user
  6. user_url – optional
  7. user_registered –  select a date using the date selector
  8. user_activation_key – leave blank
  9. user_status – leave default value of 0
  10. display_name – enter same value as nicename

After submitting the form, note the user ID that was automatically created for the new user account. You will need this to assign the proper administrator permissions.

Step 3: Assign Admin Permissions

Now, go to the wp_usermeta table and click the insert tab to go to the phpMyAdmin insert forms. You will need to add two rows. First, enter the following:

  1. umeta_id – leave blank (this is automatically generated)
  2. user_id – ID of the user you created
  3. meta_key –  enter wp_capabilities
  4. meta_value –  enter a:1:{s:13:"administrator";b:1;}

Now insert one more row with the following:

  1. umeta_id - automatically generated
  2. user_id – use the ID you created
  3. meta_key – enter wp_user_level
  4. meta_value – enter 10 

And that’s it. After inserting the above information, you can now go and log into the WordPress admin area using the new user account that you just created.

  1. This might happen if a) you have lost access to the admin email address, b) your WordPress installation cannot send email, or c) if you need to access the WP admin area but your client has not given you access credentials. []
  2. Note: There are other ways to add an admin user, such as via command line or by writing a php file to handle the request. []
  3. This file will tell you the database name as well as the table prefix. []
  4. Note: If the table prefix has been altered, all tables will have slightly different names. The table prefix can be found in the wp-config.php file. []
Tags: , , ,

8 Responses to “How to Add an Admin User to a WordPress Database”

  • Dennis Edell @ Direct Sales Marketing September 7, 2010 at 8:40 am

    Excellent info; a keeper for sure, just in case.

    However, for those like me, it might be easier to just start a new blog. LOL

  • Icechen1 December 18, 2010 at 9:15 pm

    Woo! Thanks! Bookmarked this just in case for some unlucky day.

  • Michael Houghton June 10, 2011 at 7:36 am

    This is a helpful little reminder.

    Incidentally if you are doing these steps from a database tool that doesn’t make it easy to set a password, you should be able to put more or less anything in the password field, then use the ‘recover your password’ facility to set a new one.

  • Arumugam July 7, 2011 at 3:46 am

    Thanks for the excellent information.
    And I need more help for the following point.

    How to remove the website field in the user profile section in the wp-admin without affecting the core file.

  • myself February 14, 2013 at 2:16 pm



How to Add an Admin User to a WordPress Database :

Trackback URL:

Leave a Reply

Want us to work on your project?

Contact us today for a quote. Click here to submit details regarding your project.

If you are making a general inquiry, send an email to

Go Daddy Deal of the Week: Cheap .COM Domains! Offer expires soon!