Add Administrator User in WordPress Using MySQL

Friends, today in this article we will read about how to add an Administrator user in WordPress using MySQL. Actually yesterday my best friend asked me, his WordPress website was hacked and her account has been deleted. He asked me what’s the solution how to add a new Administrator without accessing the WordPress dashboard. So, I gave her a satisfying solution, you can add administrator from MySQL.

NOTE: Before we start doing this, make sure that you have taken a backup of your website Database.

Add an Administrator from WordPress MySQL Database

Below are the two ways to perform this task, not to worry I’ll describe both:

  1. Run a MySQL query
  2. Manual Steps in MySQL

Run a MySQL query

This method is only for those who want to speed up the process. In this process, we have to make sure to change following things:

  • Table prefix( if you are Database table prefix is different ).
  • Database name
  • Values( like ID, username)
INSERT INTO 'your-database-name'.'wp_users' ('ID', 'user_login', 'user_pass', 'user_nicename', 'user_email', 'user_url', 'user_registered', 'user_activation_key', 'user_status', 'display_name') VALUES ('84', 'username', MD5('your-password'), 'Your Name', '[email protected]', '', '2017-09-08 16:15:25', '', '0', 'Your Name');
INSERT INTO 'your-database-name'.'wp_usermeta' ('umeta_id', 'user_id', 'meta_key', 'meta_value') VALUES (NULL, '84', 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');
INSERT INTO 'your-database-name'.'wp_usermeta' ('umeta_id', 'user_id', 'meta_key', 'meta_value') VALUES (NULL, '84', 'wp_user_level', '10');

Now Copy this query and paste it into SQL of your database. Great, you are an administrator of your website.

Manual Steps in MySQL

First, you need to log in to your hosting cPanel and access phpMyAdmin, and find your WordPress MySQL database, See below screenshots(Source: Godaddy cPanel).


Once you open your WordPress database, we are going to make changes in two tables, one is wp_users and the second one is wp_usermeta. Let us start with the first table wp_users, just click on the table name. We need to insert our new Administrator. Let’s click on insert tab, see below


Once you clicked on insert tab, you have to fill below fields.

  • ID: Leave it blank it is an auto-increment field. Its value will be filled automatically.
  • user_login: Insert the username from which you access the WordPress dashboard.
  • user_pass: Add strong password for the username and make sure that to select MD5 in the function drop-down menu.
  • user_nickname: Add your nickname
  • user_email: Add your email address to blend with this account.
  • user_url: You can add your website URL here.
  • user_registered: Here you can select date/time when user registering.
  • user_status: By default set as 0.
  • display_name: Add your name you wish to display

After all that click on GO button. see below

wp_users information

After inserting the user/admin information in the wp_users table, now we are going to add the value in the wp_usermeta table. Here we follow same steps, just click on table name(wp_usermeta) and again click on insert tab.

Now add following information in the Insert tab:

  • unmeta_id: Leave this field blank, it’s auto-generated.
  • user_id: In this field, you have to add the ID of the user you created in the wp_users table.
  • meta_key: Insert this wp_capabilities
  • meta_value: Insert this a:1:{s:13:”administrator”;b:1;}

We have to add few more information in another row:

  • unmeta_id: Leave this field blank, it’s auto-generated.
  • user_id: again ID of the user you created in the wp_users table.
  • meta_key: Insert this wp_user_level
  • meta_value: 10

wp_usermeta information

After all, Hit the GO button and you are now the admin of the website.

The simplest way is we can also add an Admin user in WordPress through FTP.

Hope this article helped you learn how to add an administrator user in WordPress using MySQL. Please share your thoughts in below comment box.

If you liked this article, please subscribe to our YouTube Channel for more tutorials. Keep learning and sharing.



23 thoughts on “Add Administrator User in WordPress Using MySQL”

  1. Thanks , I have recently been searching for info approximately this
    subject for a long time and yours is the greatest I’ve discovered till now.
    But, what about the bottom line? Are you sure
    concerning the supply?

  2. Hello there, You have done an excellent job. I’ll definitely digg it and
    personally suggest to my friends. I am sure they’ll be benefited from
    this web site.

  3. Thank you for all your valuable effort on this website. My mother really loves carrying out investigations and it is easy to understand why. A lot of people hear all regarding the powerful way you provide simple guides by means of your blog and therefore attract contribution from people on this subject matter and our own girl is understanding a lot of things. Enjoy the rest of the year. You are always doing a good job.

  4. Thank you for all of your work on this website. My mom takes pleasure in making time for internet research and it is easy to understand why. My spouse and i know all relating to the powerful mode you give very important tips through your website and even strongly encourage participation from other individuals on that matter and our favorite simple princess is without question discovering a great deal. Have fun with the remaining portion of the new year. You are always conducting a terrific job.

  5. I would like to express some thanks to you for bailing me out of this particular problem. Because of scouting through the the web and obtaining thoughts that were not pleasant, I figured my entire life was done. Being alive minus the strategies to the difficulties you’ve sorted out by means of your entire write-up is a crucial case, and the kind which may have in a negative way affected my entire career if I had not discovered your web blog. Your main training and kindness in handling the whole lot was important. I am not sure what I would’ve done if I hadn’t encountered such a thing like this. I am able to at this point look ahead to my future. Thank you so much for the impressive and results-oriented help. I won’t be reluctant to endorse the website to any individual who should receive guidelines about this topic.

  6. I blog frequently and I seriously thank you for your content.
    Your article has truly peaked my interest. I’m going to book mark
    your blog and keep checking for new details about once per
    week. I opted in for your RSS feed too.

  7. I’m extremely inspired with your writing abilities and
    also with the layout on your weblog. Is this a
    paid subject or did you customize it your self?
    Anyway keep up the excellent high quality writing, it is
    uncommon to see a nice blog like this one nowadays..

Please share your thought

Looking for fresh content?

Access free WordPress resources such as videos, plugins, and other helpful tools and offers.