codehaven - php snippets - coding help
Generic filters
Exact matches only

How to add a user to WordPress using the MySQL database in 10 steps

20th February 2019

Admin WP

wordpress category

If you have a zip of your WordPress files and a MySQL dump but you do not have the login and password these 10 steps will let you add a user so you can login as an administrator.
You can’t just change the backend settings and login, its a bit more involved than that….

1. Upload files to your server
2. Import mysql dump using Phpmyadmin
3. Change wp_config in files to match your database and password etc and save them again.

Now the tables
4. wp_options – Change urls from what they were to where they are now. (usually row 1 and 2)
5. wp_options – Change admin email to your own
6. wp_users – Click ‘Copy’ existing user details and create your own, change user_login name, and user_email etc
7. wp_usermeta – copy the row where this shows “a:1:{s:13:”administrator”;b:1;}” and change the user_id to 2 (the new user id you created) this has wp_capabilities in one of the fields
8. Go to wordpress login and click forgot password and add the login name that you added. This will now email you.
9. This will send you an email to reset your password.
10. Login and your done!

Was this code snippet helpful?