This guide walks you through how to create a WordPress user in phpMyAdmin using direct database manipulation. You’ll learn secure methods, password hashing, and how to assign user roles—ideal when you can’t access the WordPress dashboard.
Key Takeaways
- Understand the WordPress user database structure: Users are stored in the
wp_usersandwp_usermetatables—knowing this is essential for manual user creation. - Always hash passwords securely: Never insert plain-text passwords. Use MD5 or better yet, generate a proper WordPress-compatible hash using built-in functions or online tools.
- Assign user roles correctly: User capabilities are managed via the
wp_usermetatable—setting the right role (like administrator or subscriber) ensures proper access. - Backup your database first: Direct database edits can break your site—always create a full backup before making changes.
- Use phpMyAdmin responsibly: Only make changes if you’re comfortable with SQL and database structures—mistakes can lock you out of your site.
- Test login immediately: After creating the user, try logging in to confirm everything works before closing phpMyAdmin.
Introduction: Why Create a WordPress User in phpMyAdmin?
Sometimes, you lose access to your WordPress admin dashboard—maybe you forgot your password, got locked out, or your site was hacked. In these cases, knowing how to create a WordPress user in phpMyAdmin can be a lifesaver.
phpMyAdmin is a web-based tool that lets you manage your MySQL database directly. While WordPress provides a user-friendly interface for adding users, there are times when you need to go behind the scenes. This guide will show you exactly how to manually add a new user to your WordPress site using phpMyAdmin—safely and correctly.
By the end of this tutorial, you’ll be able to create a new admin user, set a secure password, and regain control of your site—even if the dashboard is inaccessible. We’ll cover everything from backing up your database to assigning user roles and troubleshooting common issues.
Prerequisites: What You Need Before Starting
Before diving into phpMyAdmin, make sure you have the following:
- Access to phpMyAdmin: Usually available through your hosting control panel (like cPanel, Plesk, or DirectAdmin).
- Your WordPress database name: Typically found in your
wp-config.phpfile underDB_NAME. - Database username and password: Also located in
wp-config.php. - A backup of your database: Critical! We’ll show you how to do this in the next section.
If you’re unsure about any of these, check your hosting provider’s documentation or contact support. Never proceed without a backup—direct database edits are irreversible if something goes wrong.
Step 1: Backup Your WordPress Database

Visual guide about How to Create WordPress User in Phpmyadmin
Image source: blog.racknerd.com
Before making any changes, always back up your database. This protects you from accidental data loss.
How to Backup via phpMyAdmin
- Log in to your hosting control panel and open phpMyAdmin.
- In the left sidebar, click on your WordPress database (usually named something like
yourdomain_wp). - Click the Export tab at the top.
- Choose Quick export method and SQL format.
- Click Go to download the backup file to your computer.
Keep this file safe—you can restore your site from it if anything goes wrong.
Step 2: Locate the WordPress User Tables
WordPress stores user data in two main tables:
- wp_users: Contains basic user info like username, email, and password.
- wp_usermeta: Stores additional details like user roles, capabilities, and preferences.
Note: The table prefix (wp_) may be different on your site. Check your wp-config.php file for the $table_prefix value.
Find Your Table Prefix
Open your wp-config.php file (in your WordPress root directory) and look for:
$table_prefix = 'wp_';
If it says wp123_, use that instead of wp_ in all table names.
Step 3: Insert a New User into wp_users
Now we’ll add a new user to the wp_users table.
Open the wp_users Table
In phpMyAdmin:
- Click on your database in the left panel.
- Click the wp_users table (or your custom prefix).
- Click the Insert tab.
Fill in the User Details
You’ll see fields like ID, user_login, user_pass, etc. Fill them as follows:
- ID: Leave blank—WordPress will auto-assign this.
- user_login: Your desired username (e.g.,
newadmin). - user_pass: A hashed password (see below).
- user_nicename: Same as username or a URL-friendly version.
- user_email: A valid email address.
- user_url: Optional—can be left blank or set to your site URL.
- user_registered: Current date/time in
YYYY-MM-DD HH:MM:SSformat (e.g.,2024-04-05 10:30:00). - user_activation_key: Leave blank.
- user_status: Set to
0. - display_name: How the name appears on posts (e.g.,
New Admin).
Generate a Secure Password Hash
Never use plain text! WordPress uses a hashing system based on Portable PHP password hashing framework.
You can generate a valid hash using one of these methods:
Option 1: Use an Online WordPress Password Hash Generator
Search for “WordPress password hash generator” and enter your desired password. Copy the output (starts with $P$B).
Option 2: Use WP-CLI (if available)
Run:
wp user create newadmin email@example.com --role=administrator --user_pass=yourpassword
This creates the user automatically—no phpMyAdmin needed.
Option 3: Temporary MD5 (Not Recommended for Production)
For testing only, you can use MD5. In phpMyAdmin, select MD5 from the function dropdown next to user_pass and enter your password. But note: WordPress will rehash it on first login.
For best security, use the $P$B hash method.
Step 4: Assign User Role via wp_usermeta
Now that the user exists, we need to assign a role (like administrator). This is done in the wp_usermeta table.
Find the New User’s ID
Go back to the wp_users table and note the ID of your new user. Let’s say it’s 5.
Insert Role Metadata
Click the wp_usermeta table, then Insert. Add these two rows:
First Row (User Role):
- umeta_id: Leave blank (auto-increment).
- user_id:
5(your user’s ID). - meta_key:
wp_capabilities(oryourprefix_capabilitiesif prefix differs). - meta_value:
a:1:{s:13:"administrator";b:1;}(for admin role).
Second Row (User Level):
- umeta_id: Leave blank.
- user_id:
5. - meta_key:
wp_user_level(or your prefix). - meta_value:
10(admin level).
Other common roles:
- Subscriber:
a:1:{s:10:"subscriber";b:1;}and level0. - Editor:
a:1:{s:6:"editor";b:1;}and level7. - Author:
a:1:{s:6:"author";b:1;}and level2.
Click Go to save both entries.
Step 5: Test Your New User
Now it’s time to verify everything works.
- Go to your WordPress login page:
yoursite.com/wp-login.php. - Enter your new username and password.
- Click Log In.
If successful, you’ll be redirected to the WordPress dashboard with full admin access.
If you get an error:
- Double-check the password hash.
- Verify the
wp_capabilitiesandwp_user_levelvalues. - Ensure the email is valid and not already in use.
Once logged in, consider changing the password via Users > Profile for extra security.
Troubleshooting Common Issues
Can’t Log In After Creating User?
- Check if the password hash is correct. Try regenerating it.
- Ensure the
user_statusis0(not blocked). - Clear your browser cache and cookies.
User Created But No Admin Access?
- Confirm the
wp_capabilitiesmeta_value includes"administrator". - Check that the
wp_user_levelis set to10. - Try logging out and back in—WordPress may need to refresh permissions.
phpMyAdmin Shows SQL Error?
- Verify table prefixes match your
wp-config.php. - Ensure all required fields are filled (especially
user_login,user_pass,user_email). - Check for typos in meta keys like
wp_capabilities.
Best Practices and Security Tips
- Always backup first: One wrong edit can crash your site.
- Use strong passwords: Even if hashed, weak passwords are risky.
- Delete temporary users: If you created a user just to regain access, remove it after fixing the original issue.
- Limit admin users: Only give administrator access when absolutely necessary.
- Consider using WP-CLI: It’s safer and faster than manual database edits. Learn more about WordPress tools and workflows to streamline management.
Conclusion: You’ve Successfully Created a WordPress User in phpMyAdmin
Creating a WordPress user directly in phpMyAdmin is a powerful skill—especially when you’re locked out of the dashboard. By following this guide, you’ve learned how to safely insert a new user, hash passwords correctly, assign roles, and troubleshoot issues.
Remember: direct database editing should be a last resort. Whenever possible, use the WordPress admin panel or WP-CLI. But when you need it, this method gives you full control.
Now that you’re back in, consider securing your site further. Review user accounts, update passwords, and install security plugins. And if you manage themes or need to reset access, check out our guide on how to delete a theme in WordPress or fixing 404 errors to keep your site running smoothly.
You’ve got this!