Add yourself as an admin to a WordPress site

I regularly need to add myself as an administrator to WordPress sites that someone else has installed. I’m always given database access to these sites, but no WordPress account. Why not just log in on the Admin account that’s already there? WordPress encrypts passwords in the database, so you can’t log in with the string in the ‘password’ column for the admin account. The only way to log in to that account would be to overwrite the password with one of your own, which is likely to frustrate whoever is paying you to work on their site.

In PHPMyAdmin, go to the wp_users table, and copy the first user. In every installation I’ve seen, this is an administrator account:

1

 

Write your username in the user_login, user_nicename and display_name fields, write your email address in user_email, and write a password in user_pass. You must select MD5 from the Function dropdown menu next to your password.

2

When you’ve done that, it’ll look something like this.

3

Hit Go to save your new user. Make a note of the number in the ID column next to your new user.

Edit the wp_usermeta table next. Find the entry with user_id 1 and the meta_key ‘wp_capabilities’. Hit Copy.

4

Change the user_id to the ID of the user you created in wp_users, and click Go.

5

 

You’ll now be able to login to WordPress as an administrator with the username and password you chose.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>