How to add a user in phpMyAdmin when you cant login to wordpress admin
Last week, one of my new clients reached out to me, afraid her previous Web Designer hacked her website. She told me they were having disagreements about the work done, the expense he charged for hosting, and long story short – she fired him. She paid the Designer for the website, but stopped paying for the monthly services. She can’t login to her WordPress Admin.
Her site was still up, but now she can’t login to her WordPress admin. She needed help to regain access to WordPress.
Can't Login to WordPress Admin
When I looked at her site, I noticed that she can’t login to the WordPress admin, because someone deleted all the WordPress admin users. I jumped in the database, and decided to add a new WordPress Admin user via phpMyAdmin.
All her work was still in the database, luckily. I helped her set up a Firewall and change all passwords related to her WordPress/hosting, and she was up and running that same day.
In this article, I will show you how to add a WordPress admin user via phpMyAdmin, when you can’t login to WordPress Admin
How can I add a WordPress user if I can't login to the WordPress Admin?
Note* Back your site up! All of this can be avoided, if you take backups of your site, BEFORE it happens. So, before making ANY MySQL edits, make sure you have a backup. This guide to add a WordPress user via phpMyAdmin requires basic knowledge of databases. Again, don’t forget to back your WordPress site up! Don’t know how? Let us do it for you. We have WordPress Support and cheap backups.
Need backups, but don’t have access to your site? No problem! We provide daily, automatic backups for only $3/month. Don’t know how to back up a WordPress site? We do it all for you. See our plans starting at $3 at https://login.digitallythrive.com/products/website-backup. Create an account, and after signing up – just call the number, let us walk you through the set up – Free 24/7 phone support.
1. Find the database user/password and login
Find the wp-config.php file.
When you can’t login to the WordPress Admin, you will need access to the database. First, collect your database credentials – these are not your WordPress username/pw, this will be different.
Luckily, this is simple if you have a basic understanding of WordPress file structure. Login to the file manager, and open up the folder of your WordPress site. This should be inside your hosting account. If you can’t find it, call your hosting provider.
Find the file called ‘wp-config.php‘, and open it. Look for the lines that will connect to the database. They usually look something like this:
As you can see, your database name is line 23, in this case it’s i2823_wp99. So that will be the database to edit. Your username and password are on the lines above on 26, and 29.
2. Insert user into wp_users table
When you can’t login to the WordPress admin, everything will have to be done through the Database.
Once logged into phpMyAdmin, on the top left of your screen, locate the database name and click on the link itself. This should appear directly above ‘Table Schema‘. Once you click on the link, the database rows will all appear to the right, and directly under it.
Find the wp_users table. This is the table in the database that is responsible for holding the username, password, email address, name etc. of the WordPress users. Notice in the middle of the screen, you will see multiple tabs on top of the users table. You are currently on the tab called ‘Structure’, and will need to click on the tab called ‘Browse’ on the top left.
Notice all of the users laid out in rows, in the sample above. IF you are looking to edit a user, find the username you are about to edit, you should see a pencil button to the left which you are going to click. To create a new user, click the tab above labled ‘insert‘.
Note* if you do have users listed here, but still cannot login with them, make sure the users that do exist have the number 0 for user_status. For a working WordPress Admin user, you will need the status to be set to 0.
Fill the fields out as required:
ID: refers to the unique number for each user, if you have no users you may enter the number 1. In the example 1above, 1-5 were already taken, so we created the number 6.
user_login: is your username, insert a username of your choice.
user_pass: Enter your password here, create a difficult password, you will have no reminders in the database of password strength, you won’t have the ability to type it twice, so make sure it’s accurate. Set the column Function drop down to MD5. This is what encrypts your password.
user_nicename: The nicename is (usually) a sanitized version of the username. It’s suppose to be ‘nice’ in the sense that it is the ‘nicename’ that is used as a slug (url trailing after backslash), for example: digitallythrive.com/blog/author/digitalthrive. This will also remove any capital letters and so on.
user_email: Imperative for future password resets, please input a valid email address of this user.
user_url: Non important, input a URL or website if you wish.
user_registered: Non important, but type out the registration date of the user, if you wish.
user_activation_key: Non important, leave blank if you wish.
user_status: Imperative to set as 0 for admin capabilities.
display_name: Input what your name should look like inside of the WordPress dashboard.
Hit the ‘Go‘ button on the bottom right, and this will insert the user. BEFORE HITTING GO – make sure you select ‘MD5’ under Function, next to user_pass.

3. Insert user into wp_usermeta table
After hitting Go, you will have created your first WordPress admin user in phpmyadmin! There is one more step, although we have added a user, we need to give this user permissions to be the administrator. To do this, we need to find the ‘wp_userneta’ table. This table stores the permissions of each WordPress user.
On the lefthand menu, click ‘wp_usermeta‘. Click ‘Insert‘.
Fill out the following fields, you will need the ID that you created for wp_users, that will go in user_id.
user_id: ID you created in previous step.
meta_key: will be wp_capabilities
meta_value: will be a:1:{s:13:”administrator”;b:1;}
Click Go. You should get a green Success message.
Next, click Insert on the top again, and fill out the following fields:
user_id: ID you created in previous step.
meta_key: will be wp_user_level
meta_value: will be 10
Click Go at the bottom right.
You should now be able to access the site with your new admin user. If you have issues recheck that each step is done exactly as described.
If you have a custom database prefix, ensure you’ve done each step in the respective custom prefix table name. For intsance – if you see wp_usermeta on the left, your table prefix is ‘wp_’, some have custom table prefixes, for security. For instance, wp_l24dkcE10_usermeta. Don’t forget to double check these values.
