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