Friends,
In today’s article, we’ll learn how to add an administrator user to WordPress using MySQL.
Yesterday, my best friend reached out to me because his WordPress site was hacked, and his admin account was deleted. He asked me how he could add a new administrator without accessing the WordPress dashboard. I gave him a solution: you can add an administrator directly from MySQL.
NOTE: Before proceeding, make sure to back up your website database.
Add an Administrator from the WordPress MySQL Database
Below are the two ways to perform this task. Not to worry, I’ll describe both:
- Run a MySQL query
- 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 the following things:
- Table prefix (only if your database table prefix is different).
- Database name.
- Values (such as ID, username, etc.).
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', 'test@gmail.com', 'http://www.google.com/', '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 the 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 screenshots below (Source: GoDaddy cPanel).
Once you open your WordPress database, we are going to make changes in two tables, one is the wp_users table and the second one is the 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 the insert tab, see below
Set Up the User Information
Once you click on the Insert tab, fill in the fields as described below:
- ID: Leave this field blank. It is an auto-increment field, so its value will be filled automatically.
- user_login: Insert the username from which you access the WordPress dashboard.
- user_pass: Enter the username you will use to access the WordPress dashboard.
Add Additional Details
- 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 the date/time when the user registers.
- user_status: By default set as 0.
- display_name: Add your name you wish to display
After all that, click on the GO button. see below
After inserting the user/admin information in the wp_users table, we are going to add the value in the wp_usermeta table. Here we follow the same steps, just click on the table name(wp_usermeta) and again click on the insert tab.
Now, add the 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 a 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
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.
You May Like it
Discover more from Wordpress Tutorial for Beginner's
Subscribe to get the latest posts sent to your email.






23 thoughts on “Add Administrator User in WordPress Using MySQL”
very nice and helpful article…
Hi! Do you know if they make any plugins to safeguard against hackers? I’m kinda paranoid about losing everything I’ve worked hard on. Any tips?
yes, you can use the Sucuri plugin to secure your website from hackers, Very powerful plugin.
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?
Not Understand what you said, can you please clarify…
It’s actually a great and helpful piece of information. I
am satisfied that you simply shared this helpful info with us.
Please stay us up to date like this. Thank you for sharing.
Thank you so much, keep learning and sharing
Thank you for the terrific post
Thank you so much, Zoe keep learning and sharing
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.
Thank you so much, Keep learning and sharing
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.
Thank you so much, keep learning and sharing
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.
Thank you so much, keep learning and sharing.
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.
Thank you
Ahaa, its good discussion regarding this paragraph at this place at this webpage, I have read all that,
so at this time me also commenting here.
Thanks you Tinyurl
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.
Thanks for your interest, keep learning
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..
Yeah, designed myself. Thanks