How to Add an Admin User to the WordPress Database via MySQL

Hello and thanks for watching WPBeginner. Today you’ll learn how to add an admin user to the WordPress database via MySQL. This comes in handy if your site gets hacked and your user gets deleted on your WordPress site. You’ll need to log in to PHPMyAdmin to do this.

I’ll show you what it looks like from the Cpanel of a hosting company.

Once we’re logged in and see our database, it’s a good idea to back up the database before proceeding. Over here I’ll open the wp_users table and click insert. Now I need to fill in all this information. For the password, I’ll select md5 and when I’m happy with all this, I’ll click go.

It will tell me how many rows were affected and gives me a green checkmark.

Next, we need to update the wp_usermeta table. I’ll click on that and click insert. I want to leave the unmeta_id blank and that will get autogenerated. I’ll fill out the user_id with the ID I picked before, meta_key will be wp_capabilities like this, and the meta_value will be this.

How to Add an Admin User to the WordPress Database via MySQL

Now I need to fill out another row, again leaving the unmeta_id blank, filling the user_id with the one I had before.

The meta_key for this will be wp_user_level and the meta_value is 10. I’ll click go and now I have a new user for my website that can login again. I hope you liked this video and found it helpful. If you did, click on the like button below and leave us a comment. And if you want to receive more helpful videos don’t forget to subscribe to our channel.

As found on YouTube

About the Author:

You May Also Like