Create an admin user in the WordPress database
You can create a new WordPress admin user from within the database. Use this method if your original admin user was corrupted or removed.
Warning: You should always back up your site before making changes to the database.
- Sign in to phpMyAdmin.
- In phpMyAdmin, in the left-side menu, select the name of the database your site uses.
- Under Table, look for the users table and select it by selecting the name not the checkbox. The table name is preceded by a table prefix (for example, your users table might be called wp_users or wp_1wsryb9585_users).
- From the top menu, select Insert.
- In the Value column, enter the following:
Field Value to enter ID Any number that is not already used by another user. Make note of this number since you'll need to use it when you create the wp_usermeta table entry. user_login Username for accessing the WordPress dashboard. user_pass Password for this user. Warning: Make sure to select MD5 in the Function column.user_nicename The nickname for this user. user_email Email address for this user. user_registered Select the calendar icon and then select the date and time this user was registered. user_status Set this to 0. display_name Name that will display for this user. - On the right, select Go.
- On the left-side menu, select the name of the database your site uses (repeat Step 2).
- Under Table, look for the usermeta table and note the table prefix to use it in the upcoming steps (for example, if your usermeta table is called wp_usermeta, your prefix is wp_ and if it's called wp_1wsryb9585_usermeta the prefix is wp_1wsryb9585_, and so on).
- Select the usermeta table by selecting the name not the checkbox.
- From the top menu, select Insert.
- In the Value column, enter the following:
Field Value to enter user_id Enter the ID from step 5. meta_key Enter the word capabilities preceded by the database prefix noted in Step 8 (for example, if your database prefix was wp_, enter wp_capabilities, if it's wp_1wsryb9585_, enter wp_1wsryb9585_capabilities and so on). meta_value Copy and enter the following: a:1:{s:13:"administrator";s:1:"1";}
- On the right, select Go.
- Select the Insert tab again.
- In the Value column, enter the following:
Field What it is... user_id Enter the ID from step 5. meta_key Enter the word user_level preceded by the database prefix noted in Step 8 (for example, if your database prefix was wp_, enter wp_user_level, if it's wp_1wsryb9585_, enter wp_1wsryb9585_user_level and so on). meta_value Enter number 10. - On the right, select Go.
You can now sign in to WordPress with your new username and password.
Note: To be able to sign into WordPress with a new user, your sign-in page has to work properly. If there's an error on the sign-in page, you'll have to fix the error first.
More Info
- Here's what to do if you're unable to sign in to WordPress.
- If you need any assistance with creating or managing WordPress users, our WordPress Premium Support team can help.