Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared hosting Managed WordPress Cloud hosting VPS hosting By reader location Hosting finder
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Blog Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

Setup & site building · Guide

How to Add a WordPress User in phpMyAdmin (Step by Step)

How to Add a WordPress User in phpMyAdmin (Step by Step)

Short answer

Open phpMyAdmin, insert a row in the wp_users table with the MD5 function on the password, then add two wp_usermeta rows for that user ID: wp_capabilities with the role and wp_user_level set to 10 for an admin. Back up the database first and match your table prefix.

Key takeaways

  • Only use phpMyAdmin when you cannot reach the dashboard.
  • Back up the database before inserting any rows.
  • Every key must use your real table prefix, not always wp_.
  • The capabilities value must be copied exactly to work.
  • WordPress upgrades the MD5 password hash on first login.

How do you add a WordPress user in phpMyAdmin?

To add a WordPress user in phpMyAdmin, insert a new row in the wp_users table, then add two rows in wp_usermeta that give the user a role, such as administrator.

This is mostly used when you are locked out of the dashboard and cannot create a user the normal way. If you can still log in, use Users > Add New instead, because it is safer.

The whole process takes about ten minutes. You need access to your hosting control panel and phpMyAdmin.

StepTableWhat you add
1wp_usersUsername, password hash, email, display name
2wp_usermetawp_capabilities with the role
3wp_usermetawp_user_level set to 10 for admins
4NoneLog in and save the profile

When should you add a user through phpMyAdmin?

Use phpMyAdmin only when you cannot reach the dashboard, for example after a hack removed your admin account, a lost password with no working email, or a site handed over without login details.

In every other case, the WordPress admin screen is better. It hashes the password properly, sends the right notifications and avoids typing mistakes in the database.

If you have SSH access, WP-CLI is another safe option. The wp user create command creates a full user, role included, in one line.

If your admin account was taken over, also read our guide on recovering a hacked WordPress admin account. Adding a new user alone does not remove an attacker.

What should you do before editing the database?

Back up the database first, because a wrong change in phpMyAdmin takes effect immediately and there is no undo button.

In phpMyAdmin, select your database, click Export, keep the quick method and SQL format, then click Go to download a copy. Our guide on backing up a WordPress database explains other methods.

Next, find the right database. Open wp-config.php and look for DB_NAME. Our guide on finding your WordPress database name shows where to look.

Finally, check the table prefix in the same file. It is the $table_prefix value. Many sites use wp_, but yours might be something like wpx7_. Replace wp_ with your prefix in every step below.

How do you open phpMyAdmin?

Log in to your hosting control panel, find the Databases section, and click phpMyAdmin, then choose your WordPress database from the left sidebar.

In cPanel, it sits under Databases > phpMyAdmin. Other hosts often have a Database or MySQL tab with a phpMyAdmin button.

After it opens, click your database name. You will see tables like wp_options, wp_posts, wp_users and wp_usermeta.

If you are new to the tool, the official phpMyAdmin documentation explains the interface.

How do you add the user to the wp_users table?

Click the wp_users table, open the Insert tab, fill in the login, password, email and dates, choose MD5 as the function for the password field, and click Go.

Fill in these fields:

FieldWhat to enter
IDLeave empty so it increments automatically
user_loginThe new username, such as newadmin
user_passYour new password, with the MD5 function selected
user_nicenameA lowercase version of the username
user_emailAn email address you can access
user_urlOptional, can be left blank
user_registeredToday's date and time
user_activation_keyLeave empty
user_status0
display_nameThe name to show on the site

After clicking Go, phpMyAdmin shows the new row. Note the ID it was given, for example 5. You need it in the next step.

The MD5 function is only a temporary step. WordPress recognises the old MD5 format and replaces it with a stronger hash the first time the user logs in. The wp_hash_password reference describes how WordPress stores passwords.

Pick a long, unique password. You can change it again later from the profile screen.

How do you give the new user a role?

Open the wp_usermeta table and insert two rows for the new user ID: wp_capabilities holding the role, and wp_user_level set to 10 for an administrator.

Click wp_usermeta, open Insert, and add the first row:

  • umeta_id: leave empty.
  • user_id: the ID from the previous step, such as 5.
  • meta_key: wp_capabilities
  • meta_value: a:1:{s:13:"administrator";b:1;}

Then add the second row:

  • umeta_id: leave empty.
  • user_id: the same ID.
  • meta_key: wp_user_level
  • meta_value: 10

The meta_value in the first row is a serialized PHP array. It must be copied exactly. The number 13 is the length of the word administrator, so a typo there breaks the role.

If your prefix is not wp_, the meta keys change too. A prefix of wpx7_ means the keys become wpx7_capabilities and wpx7_user_level.

Can you add the user with an SQL query instead?

Yes, you can run SQL from the SQL tab in phpMyAdmin, which is faster and avoids missing a field, as long as you update the prefix, username, email and password first.

INSERT INTO wp_users
  (user_login, user_pass, user_nicename, user_email, user_registered, user_status, display_name)
VALUES
  ('newadmin', MD5('ChangeThisPassword!'), 'newadmin', '[email protected]', NOW(), 0, 'New Admin');

SET @uid = LAST_INSERT_ID();

INSERT INTO wp_usermeta (user_id, meta_key, meta_value) VALUES
  (@uid, 'wp_capabilities', 'a:1:{s:13:"administrator";b:1;}'),
  (@uid, 'wp_user_level', '10');

LAST_INSERT_ID() grabs the ID of the user you just created, so you do not need to look it up. The MySQL manual covers the INSERT statement if you want the full syntax.

Run both statements together in one go so the variable is still set.

What values work for other roles?

You can create editors, authors and other roles by changing the role name in wp_capabilities and using a matching length and user level.

Rolewp_capabilities valuewp_user_level
Administratora:1:{s:13:"administrator";b:1;}10
Editora:1:{s:6:"editor";b:1;}7
Authora:1:{s:6:"author";b:1;}2
Contributora:1:{s:11:"contributor";b:1;}1
Subscribera:1:{s:10:"subscriber";b:1;}0

User levels are a legacy system, but WordPress still reads them in a few places, so it is worth setting them.

The official Roles and Capabilities page explains what each role can do. Our guide on WordPress user roles covers the same in plain English.

How do you finish setting up the new account?

Log in at /wp-login.php with the new username and password, open Users > Profile, check the details, and click Update Profile so WordPress fills in the remaining settings.

Saving the profile once adds default meta values, such as editor preferences and admin color scheme. It also triggers the stronger password hash.

Then tidy up:

  1. Change the password to a new strong one from the profile screen.
  2. Turn on two-factor authentication if you use a security plugin.
  3. Review the other users and remove any you do not recognise.
  4. Delete any old database exports you downloaded to your computer.

If you created the account because you were locked out, our guide on fixing being locked out of wp-admin covers the underlying causes.

Why can't you log in with the new user?

Login usually fails because the table prefix in the meta keys is wrong, the serialized role value has a typo, or the password was saved without the MD5 function.

Check these in order:

  • The meta keys use the same prefix as $table_prefix in wp-config.php.
  • The wp_capabilities value matches the table above exactly, including quotes and semicolons.
  • The user_pass field holds a hash, not your plain password.
  • The user_id in wp_usermeta matches the ID in wp_users.

If you log in but see Sorry, you are not allowed to access this page, the role is wrong or missing. Fix the capabilities row and try again.

If the password itself is the problem, our guide on changing a WordPress password includes a phpMyAdmin method.

On multisite networks, a regular admin is not a super admin. You also need to add the username to the site_admins value in the wp_sitemeta table, which is a more delicate edit.

Frequently asked questions

Is it safe to add a WordPress user through phpMyAdmin?

It is safe if you back up the database first and enter the values carefully. Mistakes take effect at once with no undo. If you can still reach the dashboard or have SSH access, the Users screen or WP-CLI is a safer choice.

Why use MD5 for the password if it is weak?

MD5 is just a temporary format that WordPress still accepts. When the user logs in for the first time, WordPress replaces it with its modern, stronger hash. Change the password from the profile screen afterwards to be extra safe.

What is wp_capabilities in WordPress?

It is a user meta entry that stores the user's role as a serialized PHP array. For an administrator, the value marks the administrator role as true. The key name starts with your table prefix, so it may not always begin with wp_.

How do I find my WordPress table prefix?

Open wp-config.php in your site's root folder and look for the line that sets table_prefix. The value, such as wp_ or something random, appears in front of every table and in user meta keys like capabilities and user_level.

Can I make an existing user an administrator in phpMyAdmin?

Yes. Find the user's ID in wp_users, then edit their capabilities row in wp_usermeta and set it to the administrator value. Also set the user_level row to 10. Clear any login sessions and log in again to apply the change.

Sources

  1. wp user create WordPress Developer Resources
  2. Roles and Capabilities WordPress.org
  3. phpMyAdmin documentation phpMyAdmin
  4. INSERT statement MySQL
  5. wp_hash_password() WordPress Developer Resources

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

Written and checked byWPLegible Editorial Team Independent WordPress reviews and guides

Researched from the primary sources listed above and checked against our editorial rules before publishing.