Web Design and Development
Under normal circumstances, if you have lost access to the WordPress administration area, you can simply use WordPress’ password recovery feature to reset your password. However, there are some cases when this isn’t possible.1 Fortunately, if you can access the database directly, it is easy to add an admin user.
This tutorial will show you how to manually add an admin user via phpMyAdmin.2
If you have FTP access, the quickest way to retrieve the database details is by opening up the wp-config.php file located at the root of the WordPress installation.3 However, if you do not have access to this file, you can log into phpMyAdmin and verify that you are looking at the proper database by matching the site urls in the wp_options table.
You will now need to add a new user. On most installations, the table that you need to find is wp_users, as shown in the image at left.4 To get to the table, just click on the table’s name.
Next, click on the Insert tab. (You will find the insert tab in the horizontal list of links located across the top of the page. See the image at left.) This will bring up an insert form which will allow you to add new values to the table.
Now, enter following information in the fields:
After submitting the form, note the user ID that was automatically created for the new user account. You will need this to assign the proper administrator permissions.
Now, go to the wp_usermeta table and click the insert tab to go to the phpMyAdmin insert forms. You will need to add two rows. First, enter the following:
Now insert one more row with the following:
And that’s it. After inserting the above information, you can now go and log into the WordPress admin area using the new user account that you just created.