How to Add An Admin User via MySQL in WordPress
Today, we will learn How to Add An Admin User via MySQL in WordPress. Sometimes your website was hacked, you forgot your password, or for some reason, you cannot log in to your website and do not despair. In this case, another way to gain access to your user account is to create a new WordPress admin user by directly MySQL database table.
How to create a new WordPress admin user with phpMyAdmin
Here’s how to create your new admin user:
Step 1: Access the MySQL database
If you add a new user, you’ll need to access phpMyAdmin.
Step 2: Go to the wp_users table
Now, select your database from the list of databases on the left. Then, click on the wp_users
table.
Step 3: Insert a new admin user in the wp_users table
Open the wp_users
table and click on the Insert tab.
Fill in the following details:
Step 4: Insert user meta values
Go to the wp_usermeta table and click on Insert. just look for the table that says wp_usermeta.
Fill in the following values:
- user_id: Fill in the ID of the user you created in the previous step.
- meta_key: Enter wp_capabilities
- meta_value: Fill in the field with a:1:{s:13:”administrator”;s:1:”1″;}