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

Today you’ll learn how to add an admin user to 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 login to the 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 backup 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.

I’ll click go

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.

Оставьте комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *

Пролистать наверх