Wordpress - create new admin user via phpmyadmin

Hi

Two parts:

How can I tell which WP user is an administrator via phpmyadmin?

I need to create a new admin user via phpmyadmin. The few sites I found that list the steps and the query seem to have problems with the code (as I read the comments on those pages). And I've not done a query before.

I've taken a backup of the database, and this site is on WordPress 3.8.5

thx
Trevor LocalAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jason C. LevineDon't talk to me.Commented:
How can I tell which WP user is an administrator via phpmyadmin?

Look in the wp_usermeta table for the wp_capabilities key (if you are using a custom prefix for tables, the key will also have that prefix) with the following value:

a:1:{s:13:"administrator";b:1;}

Get the user_id from that row, look up that user in wp_users.  That's your administrator.

I need to create a new admin user via phpmyadmin. The few sites I found that list the steps and the query seem to have problems with the code (as I read the comments on those pages). And I've not done a query before.

It's not that complex and can be done from the phpMyAdmin interface.

1) Create a new user account by inserting a new row in wp_users.  Leave the password blank (you'll just be resetting it anyway) but make sure you add a working email address.  After insert, get the WP ID number assigned.

2) Insert two new rows into wp_usermeta.  One takes the key wp_capabilities and has the value I pasted above.  The second row has the key wp_user_level and a value of 10.  Make sure you add the user ID from step 1 when inserting both rows.

3) Now reset the password from the WordPress login like you normally would.  Once you reset the password, you'll be able to login with admin privileges.

Alternately, if you are hijacking the site from an admin who isn't around any longer just locate that user as I described above and change the email on the account to yours.  Then reset the password and login.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Trevor LocalAuthor Commented:
thanks for the explanation. I found the admin user, but I will still create my own as well.

I inserted the new row in wp_users, now trying to insert rows into wp_usermeta. I don't see an option or where to insert  the wp_capabilities key or wp_user_level.
Jason C. LevineDon't talk to me.Commented:
If you are using PHPmyadmin then you are inserting into the user ID, key, and value columns. Wp_capabilities is the actual text you are inserting.

The user ID is the user ID.  The key is wp_capabilities, the value is that string from my original post.

Then repeat with user ID, wp_user_level, and 10
Trevor LocalAuthor Commented:
That was it....thanks again. Worked like a charm.
Trevor LocalAuthor Commented:
thanks!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
WordPress

From novice to tech pro — start learning today.