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:
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.
When you’ve done that, it’ll look something like this.
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.
Change the user_id to the ID of the user you created in wp_users, and click Go.
You’ll now be able to login to WordPress as an administrator with the username and password you chose.