You can create a new WordPress admin user directly from the database. Use this method if you need to add a new user to the site without having to sign in to the WordPress dashboard.
1. Open phpMyAdmin
2. Select your database
3. Select the wp_users table
- If you have a custom database prefix this will instead be yourprefix_users. Be sure to take this into account in later steps as well.
4. Click Insert at the top and Fill out the required new user data
- ID — Enter any available ID number. You’ll need to know this ID number later!
- user_login — The username for this user.
- user_pass — The raw password the user will login with.
- NOTE: The function dropdown to the left must be set to MD5 or the password WILL NOT WORK.
- user_nicename — The author slug or name (EX: your-name).
- user_email — The email address associated with this user.
- user_status — Set this to 0
- display_name — The display name for the user (EX: Your Name)
5. Click Go at the bottom
6. Click Go again on the query page – You should get a green check mark and success banner. If you get a red error at the bottom the user has not been inserted. Follow the error message to correct the issue until you are successful.
7. On the left hand menu click wp_usermeta
8. Click Insert at the top and Fill out the following required fields for user capabilities:
- user_id — Same ID from Step 4
- meta_key – wp_capabilities
- meta_value — a:1:{s:13:”administrator”;b:1;}
9. Click Go at the bottom
10. Click Go again on the query – You should get a green check mark and success banner. If you get a red error at the bottom the user has not be inserted. Follow the error message to correct the issue until you get a success.
11. Click Insert at the top again
- user_id – Same ID from step 4
- meta_key – wp_user_level
- meta_value – 10
12. Click Go at the bottom. 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.