Home » » Blog / News » News » How to Add an Admin User to the Wordpress Database
This post will cover how to add an Amin User to your Wordpress database. Generally you will not need to do this unless you have somehow removed your Admin user from your database. Usually you will need to just reset your Admin User’s password. But if you ever do need to add an admin user to Wordpress through phpMyAdmin this is how you would do it.
First things first, you will need to log into phpMyAdmin and locate your Wordpress database. If you do not know your username, password, or even the name of your database you can find it in your wp-config.php file. This information is found between lines 18 and 26 of the wp-config.php file. They look like this:
/** The name of the database for WordPress */
define('DB_NAME', 'yourdb_wp');
/** MySQL database username */
define('DB_USER', 'youruser');
/** MySQL database password */
define('DB_PASSWORD', 'yourpassword');
Select your database from the database select menu in phpMyAdmin. Your database will be loaded and you will now see a list of your database tables. You will need to change the wp_users and the wp_usermeta table. Click on the wp_users table to bring up the data for that table. You should see a list of the current users come up – or if you do not have any users you will see the list of database fields available.
Click on the table you want to view
Click on the Insert tab
We will need to insert a row into the database with our admin users information. Click on the "Insert" tab in order to bring up the phpMyAdmin insert form. Insert the following information:
Ok now that you have got all of that information entered you will need to hit the "Go" button at the bottom of the phpMyAdmin window. You should be redirected to a page that shows the results of your query. If there are no errors continue with editing the wp_usermeta table.
So now that we have inserted our user we will need to give it privileges to access the Wordpress Admin seciton. This is done through the wp_usermeta table. You will need to know the id of the user you just created. If you don’t know the id now would be a good time to check the wp_users table for it. We will need to insert two rows into the wp_usermeta table, wp_capabilities and wp_user_level. Here are the steps you will need to follow to give your user privileges.
a:1:{s:13:"administrator";b:1;}Now you should be able to login to your wp-admin page with the username and password you specified for this user. After logged in I would visit the Users section within Wordpress, click edit on the user I just added, and click the Update Profile button at the bottom of the screen. This will allow Wordpress to go through and add some more information and "clean up" the user we just added.
That’s it – if you have issues visit our support page to learn how to receive support.
Tags: WordPress Website Design
RSS feed for comments on this post. TrackBack URL


Great post. Short and informative.
Hopefully it’s not too often you have to do this, but I was just confronted with this situation, and, not having done it before, knowing the values to insert into the meta_key and meta_value fields was priceless. Thank you.
Comment by Toby — December 18, 2009 @ 4:49 pm
Glad we could help Toby. Remember to store that info now!
Comment by zach — December 18, 2009 @ 4:56 pm
I got into this situation due to rebuilding my amember database integrated with wordpress. broke my head for more than 8 hours before I got this clue..thanks a lot and a great information…
Comment by Vinnie Ryan — January 20, 2010 @ 6:28 am
Also, if you need to add someone as editor, insert the following in replacement of the administrator comment:
a:1:{s:6:”editor”;b:1;}
Comment by Zack — February 11, 2010 @ 11:15 pm
[...] the original post here: How to Add an Admin User to the Wordpress Database | DNA Web Agency Tags: mysql, [...]
Pingback by wp-popular.com » Blog Archive » How to Add an Admin User to the Wordpress Database | DNA Web Agency — February 18, 2010 @ 9:41 pm
great info and very helpful
Comment by sds drill bits — March 18, 2010 @ 2:18 pm
[...] to the comments for this post? Big hugs and kisses out to DNA Web Agency for this uber-helpful information lifted for this tutorial. [...]
Pingback by Manually Adding an Admin to WordPress Database – Recovering Lost WP Admin Passwords — April 13, 2010 @ 12:03 pm
thanks mate this was amazingly helpful, thanks allot, i was trying to maka a wp user from some other application interface and followed two steps in php coding 1) MD5( $pass )
2) setting wp_capabilities and wp_user_level like you said.
Thanks!
Comment by arpit tiwari — May 12, 2010 @ 12:43 am
Thanks, I have FTP access so I built a script. In WPMU add _1
‘meta_key’ => ‘wp_1_capabilities’,
‘meta_value’ => ‘a:1:{s:13:”administrator”;b:1;}’
‘meta_key’ => ‘wp_1_user_level’,
‘meta_value’ => ‘10′
Regards.-
NomikOS.-
Comment by NomikOS — June 1, 2010 @ 11:10 pm
Hi! I just wanted to say your site is one of the nicely laid out, most inspirational I’ve come across in quite a while. Thx!
Comment by Sandra — June 15, 2010 @ 10:42 pm
i owe you a lot.
been looking for a way to solve my problem. took me almost an hour. thanks for this tutorial. i had to create a new admin. i just wonder how my admin status changed to subscriber. i checked on the other users via phpmyadmin and they’re all subscribers.
but again, i owe you a lot.
Comment by enad — June 23, 2010 @ 6:53 am
Great article, thank you for putting it together its just helped massively!
Comment by Nick — July 30, 2010 @ 5:46 am
I had someone hack into my database and change my admin info and remove it’s admin privileges and I had no idea what was going on.
This finally helped me get back into my wordpress install as an admin.
Thanks a ton!
Joe
Comment by Joe Lavery — August 1, 2010 @ 12:05 am
Thank you. You helped me ALOT with this article.
Estani
Comment by Estanislao — August 2, 2010 @ 7:08 am
Hi folks,
I have a problem. I used the method you describe above at http://www.dnawebagency.com/how-to-add-an-admin-user-to-the-wordpress-database to create a new admin user (all the user tables were erased when I imported the wordpress backup, so no admin user) so I created a subscriber then there were user tables.
So then I used your method twice to create two different admin users (the php my admin sees them both as administrators when I browse them) but when I login I get “You do not have sufficient permissions to access this page.” ???
Where do I go next and what is the problem. My new host is GoDaddy and they have just lately come to the wordpress table. Ha ha I made a funny.
Okay, the site is pacifictribune.com. Can you help me to add-an-admin-user-to-the-wordpress-database?
Aloha,
John Shklov
Comment by john shklov — August 4, 2010 @ 9:45 pm
Unfortunately this didn’t solve my problem. I am moving my WP 3.0.1 install from one server to another, and it’s not going too well. The blog is there, seems to be okay, but I cannot post a post, it’s looking like I’m not admin, even though I’m logged in as an administrator. And I just followed this process to create a new admin, and that new admin is not letting me post either. *sigh*
Comment by Cynthia — August 25, 2010 @ 2:46 pm
Worked perfectly thanks!
I have a site I’m helping to develop, but they didn’t want to give me admin access… Only Full FTP and SQL haha.
Comment by Abeon — August 29, 2010 @ 4:50 am
Thanks so much for this info!
For anyone who finds they’re unable to log in right away, go through the ‘lost password’ procedure and reset your password. This worked for me, and I was able to log in and set my password back again. It’s possible the most recent WP installation uses a higher encryption than MD5.
Comment by Rick — September 19, 2010 @ 11:49 pm
Thank you so much for a great informative article – you saved me a lot of headaches with this excellent quick fix!
Bill
Comment by Bill — September 25, 2010 @ 3:19 pm
Thanks for sharing
Lifesaver.
Comment by David Lockie — October 12, 2010 @ 1:49 pm
Thanks for this, it’s been a big help.
Comment by Simon — October 18, 2010 @ 11:33 pm
This was very well layed out, followed directions all was added, however still did not give me admin privs and I can not find my wp configure file, my site has been severly hacked and they stole my admin privs and I am not able to get the file etc. and have limited knowledge. Would appreciate any help, even my “web designer” is suggesting I start over.
Comment by Jordana — October 30, 2010 @ 9:53 am
Nice, to the point and most importantly correct! Thanks for sharing
Comment by Michael Quillinan — November 3, 2010 @ 12:29 pm
Thanks a lot DNAWEBAGENCY. This post very helpful. My client blog has been hack. They hack the index.php. They also delete the user. What i need to do is create new user and follow all your tutorial above using phpmyadmin.
Damn hackers!
Cheers mate, you rocks!
Comment by Baloot — November 13, 2010 @ 12:51 am
Adding a WordPress admin account to the database…
I recently had a situation where the admin account on a WordPress installed site got removed or merged into another user account. Obviously WordPress doesn’t allow you to create new admin accounts outside the CMS so I was stuck and locked out fro…
Trackback by BedroomPublishing.com — November 15, 2010 @ 1:11 am
Thanks!Thanks!Thanks! I had a lot of problems and now I solved them.
Comment by i4ever — November 17, 2010 @ 1:57 pm
[...] Cum sa adaugi un nou admin -aici 2.Manualul de utilizare wordpress 3. Forum wordpress.org 4.String functions – aici 5. Recover [...]
Pingback by Tutoriale utile — November 17, 2010 @ 3:17 pm
Thanks, very helpful.
One quick note: If you’ve named your database tables with a prefix other than “wp_” you’ll need to edit the above accordingly. And I’ve read that it’s more secure if you do change that default prefix to something else.
This happens in the wp-config.php file:
**
* WordPress Database Table prefix.
*
* You can have multiple installations in one database if you give each a unique
* prefix. Only numbers, letters, and underscores please!
*
$table_prefix = ‘yourprefixhere_’;
Comment by Jim — December 2, 2010 @ 9:55 am
I didn’t have access to phpMyAdmin. I was able to get it done using mysql command line. Thanks for posting.
Comment by Pius Ekhaeyemhe — December 2, 2010 @ 2:12 pm
@John Shklov, if you have an error that says “You do not have sufficient permissions to access this page”, you may want to check your prefix in wp_capabilities row in wp_usermeta table. You must use the wordpress table prefix when adding the wp_capablities row. Ex. if your wordpress users table is wpg_users, you must use wpg_capabilities when adding that row to your usermeta table.
Comment by Pius Ekhaeyemhe — December 2, 2010 @ 4:25 pm
[...] http://www.dnawebagency.com/how-to-add-an-admin-user-to-the-wordpress-database This entry was posted in Wordpress and tagged admin, mysql, phpMyAdmin. Bookmark the permalink. ← find events assosiated with elements [...]
Pingback by Adding admin user from phpMyAdmin | mindeater.com – web builder — December 2, 2010 @ 6:58 pm
[...] A way to avoid that is to create a new admin user that is different from your original one (click here for the instructions on how to do that). After you finish this task, you have to log out of your [...]
Pingback by ToffsyHeart.com » Wordpress Security Tips (or how to stop those Wordpress hackers) — December 7, 2010 @ 5:21 pm
Great instructions. I’m writing a short article on Wordpress and one of the things I just wanted to do is to write a simple instruction on how to add an admin to your Wordpress account, but it seems you have done the work for me, so I’ll just send my readers here. Thanks
Comment by Toffsy Heart — December 7, 2010 @ 6:10 pm
Thanks! I’m back in.
Maybe helpful for others: if you didn’t use the default table prefix (’wp_’), change the instructions above accordingly. So, wp_capabilities becomes yourprefix_capabilities and wp_user_level should be yourprefix_user_level
Comment by Edde — December 30, 2010 @ 10:21 am
Thanks for this informative article. Now I can fix my problem. thanks a lot for sharing..!
Comment by alex — January 14, 2011 @ 6:18 pm
Thanks a lot
Saved my day. Special thnx goes to Gooooogle and to this precious page.
Comment by Muggo — January 19, 2011 @ 6:57 am
thank you so much for this post, my blog was crashed for a good couple of days as I worked day and night to figure it out. yours was one of three posts I found that, combined, helped me fix it. wonderful.
Comment by austin s. — February 3, 2011 @ 9:38 pm
Outstanding! Thanks!
Comment by JJ — February 11, 2011 @ 10:19 am
Had a client site get hacked and this tutorial is spot on. Thanks for the help!
Comment by nickhempsey — March 1, 2011 @ 11:19 am
Hi
Thanks so much for this article.
I had issue with my WP blog – admin user was not found so I had access to DB, files but not WP admin.
I created new user admin1 just like you described above and gain access to blog.
After that i simply deleted corrupted admin and created new admin
Works!
Thanks!
Comment by Dmitri — March 5, 2011 @ 5:36 am
Just what I was looking for! Someone hacked one of my sites, and made me a subscriber… Could not see how to fix this… Someone sent me this link, and it solved my problem! Thank you so much!!!!
Comment by Diana — March 5, 2011 @ 11:54 pm
thanks – you should be #1 on the google SERPs! worked like a charm
Comment by Neil Cowley — March 8, 2011 @ 9:44 am
Hey, thanks very much for posting this! You guys saved me a bunch of time by enabling me to do these steps. I really appreciate it.
regards,
Charlie
Comment by Charlie — April 17, 2011 @ 1:31 pm
[...] cool thing I found was a way to add WordPress users for site directly through MySql – http://www.dnawebagency.com/how-to-add-an-admin-user-to-the-wordpress-database. I need to get this migration done and tested. It’s keeping me from working on revenue generating [...]
Pingback by Wealth Strategies Journal – Day Five « Wealth Strategies — May 4, 2011 @ 8:59 pm
Never leave comments…BUT this one saved my a$$ big time….YEAH BOIIIII
Comment by NYCKIDD — May 9, 2011 @ 11:39 am
[...] first user so I decided to add another one, this time a real admin. I followed the advice at the dna web agency on account of with a name like that, how could they not be trustworthy? Well, outside of some [...]
Pingback by » The Endless Login Acta Monasteri — May 15, 2011 @ 12:48 pm
Thanks! This info saved me today. For some reason, my Wishlist plugin wreaked havoc and removed my admin user when someone registered for a course I’m hosting on my Wordpress site.
Life saver!
Cheers,
Tia
Comment by Tia — May 20, 2011 @ 1:22 pm
Nice article.
Once visit http://www.wordpressstop.com to get lot of stuff regarding to Wordpress.
Comment by Prasad — May 28, 2011 @ 5:45 am
many thanks buddy
Comment by Reddy — June 17, 2011 @ 12:34 pm
I’d been working on this issue for a couple of hours when I finally find this. Total lifesaver! Thanks much for creating it!
Comment by Tara — June 23, 2011 @ 3:39 am
Cheers for this. Needed to add myself as admin after I lost my email details. Phew!
Comment by PCO Licence — June 28, 2011 @ 9:09 am
You’re welcome. Glad it helped, it’s saved us a few times!
Comment by zach — June 29, 2011 @ 9:43 am
Oh.. Great post. This helped me to login into my client wordpress blog with admin power.
Thank you so much.
Comment by Libin V Babu — August 1, 2011 @ 12:15 am
Thanks it worked! I wanted to make a new admin, just because my first one dont cope with my comments. It’s suppose to say that i am the admin in the commentsection but still, it doesn’t. I guess i have another problem….
Comment by Caroline — August 22, 2011 @ 7:15 am
Hi, I follow the instructions, when I logged in, the following message came up: You do not have sufficient permissions to access this page.
How do I fix this.
Your help is deeply appreciated.
Many thanks.
Comment by Sui Anukka — August 27, 2011 @ 1:09 pm
Great post! I knew there would be a way to do it. Thanks!
Comment by Rob — September 30, 2011 @ 5:37 am