WordPress Help

Create an admin user in the WordPress database

You can create a new WordPress admin user from within the database. Use this method if your original admin user was corrupted or removed.

Warning: You should always back up your site before making changes to the database.
  1. Sign in to phpMyAdmin.
  2. In phpMyAdmin, in the left-side menu, select the name of the database your site uses.
  3. Under Table, look for the users table and select it by selecting the name not the checkbox. The table name is preceded by a table prefix (for example, your users table might be called wp_users or wp_1wsryb9585_users).
  4. From the top menu, select Insert.
  5. In the Value column, enter the following:
    FieldValue to enter
    IDAny number that is not already used by another user. Make note of this number since you'll need to use it when you create the wp_usermeta table entry.
    user_loginUsername for accessing the WordPress dashboard.
    user_passPassword for this user.
    Warning: Make sure to select MD5 in the Function column.
    user_nicenameThe nickname for this user.
    user_emailEmail address for this user.
    user_registeredSelect the calendar icon and then select the date and time this user was registered.
    user_statusSet this to 0.
    display_nameName that will display for this user.
  6. On the right, select Go.
  7. On the left-side menu, select the name of the database your site uses (repeat Step 2).
  8. Under Table, look for the usermeta table and note the table prefix to use it in the upcoming steps (for example, if your usermeta table is called wp_usermeta, your prefix is wp_ and if it's called wp_1wsryb9585_usermeta the prefix is wp_1wsryb9585_, and so on).
  9. Select the usermeta table by selecting the name not the checkbox.
  10. From the top menu, select Insert.
  11. In the Value column, enter the following:
    FieldValue to enter
    user_idEnter the ID from step 5.
    meta_keyEnter the word capabilities preceded by the database prefix noted in Step 8 (for example, if your database prefix was wp_, enter wp_capabilities, if it's wp_1wsryb9585_, enter wp_1wsryb9585_capabilities and so on).
    meta_valueCopy and enter the following:
    
    a:1:{s:13:"administrator";s:1:"1";}
  12. On the right, select Go.
  13. Select the Insert tab again.
  14. In the Value column, enter the following:
    FieldWhat it is...
    user_idEnter the ID from step 5.
    meta_keyEnter the word user_level preceded by the database prefix noted in Step 8 (for example, if your database prefix was wp_, enter wp_user_level, if it's wp_1wsryb9585_, enter wp_1wsryb9585_user_level and so on).
    meta_valueEnter number 10.
  15. On the right, select Go.

You can now sign in to WordPress with your new username and password.

Note: To be able to sign into WordPress with a new user, your sign-in page has to work properly. If there's an error on the sign-in page, you'll have to fix the error first.

More Info