Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

How to Add an Admin User to WordPress Using phpMyAdmin

Locked out of WordPress? This guide shows you how to create a new administrator by editing the database.

WordPress2 min read11 steps7 screenshots

What is this about?

A database is where WordPress stores your users, posts and settings. Think of it as a big filing cabinet. phpMyAdmin is a tool that lets you open that cabinet and look inside. You find it in cPanel, the control panel for your hosting.

An administrator is a user with full power over the site. Use this method only if you cannot log in any other way. Try the "Lost your password?" link first.

Warning: a wrong change can break your site. Take a backup of the database first. In phpMyAdmin, click Export and then Go to save a copy.

Steps

  1. Log in to your client area at https://secure.hostvento.com/clientarea.php and open cPanel from your hosting service.
  2. Click phpMyAdmin in the Databases section.
  3. Click your WordPress database on the left. If you are not sure which one, check DB_NAME in the wp-config.php file.
    Screenshot: Click your WordPress database on the left. If you are not sure which one, check DB_NAME in
  4. Click the table wp_users. Your prefix may differ from wp_.
    Screenshot: Click the table wp_users . Your prefix may differ from wp_ .
  5. Click the Insert tab.
    Screenshot: Click the Insert tab.
  6. Fill in these fields:
    • user_login: the new username
    • user_pass: a password. Pick MD5 in the Function drop-down beside it.
      Screenshot: user_pass : a password. Pick MD5 in the Function drop-down beside it.
    • user_nicename: the same as the username
    • user_email: your email address
    • user_status: 0
    • display_name: the name to show
  7. Click Go. Note the new ID number shown for the user.
  8. Open the table wp_usermeta and click Insert.
  9. Add the first row: user_id is your new ID, meta_key is wp_capabilities, and meta_value is:
    a:1:{s:13:"administrator";b:1;}
    Screenshot: Add the first row: user_id is your new ID, meta_key is wp_capabilities , and meta_value is
  10. Click Go, then insert a second row: user_id is your new ID, meta_key is wp_user_level, and meta_value is 10.
    Screenshot: Click Go , then insert a second row: user_id is your new ID, meta_key is wp_user_level , a
  11. Click Go. Log in with the new username and password.

If your table prefix is not wp_, use your own prefix in the meta_key names.

Tip: After you log in, change your password in the dashboard. WordPress then stores it in a stronger form than MD5.

Quick recap

  • Back up the database before you change it.
  • Add a row to the users table with a new username and an MD5 password.
    Screenshot: Add a row to the users table with a new username and an MD5 password.
  • Add the capability and level rows in the usermeta table.
  • Log in, then set a new strong password.