• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Tips and Tricks HQ

  • Home
  • Projects
    • All Projects
    • Simple WP Shopping Cart
    • WP Express Checkout Plugin
    • Accept Stripe Payments
    • WP Download Monitor
    • Easy HTTPS Redirection
    • WP Security and Firewall Plugin
    • WP eStore Plugin
    • WP Affiliate Platform
    • WP eMember
  • Products
    • All Products
    • Checkout
  • Support
    • Support Portal
    • Customer Only Forum
    • WP eStore Documentation
    • WP Affiliate Software Documentation
    • WP eMember Documentation
  • Contact

Create a WordPress Admin User for A WordPress Site via MySQL (PHPMyAdmin)

Home » Blog » Create a WordPress Admin User for A WordPress Site via MySQL (PHPMyAdmin)

Last updated: May 5, 2025 by Ruhul Amin


One of our users site got hacked and the WP Admin user account password was changed by the hacker. This essentially locked the user out of his admin dashboard. It is best (for situations like this) to just create a new admin user account to gain access to WP admin dashboard and fix things as needed.

In this tutorial I will show you how you can create a new WordPress admin user account via MySQL database (without having access to your WordPress admin dashboard).

Alternatively, you can add a WordPress admin user account via PHP.

Note: You can ONLY do this if you are the site owner. You need to have access to cPanel/Control Panel of your server (comes with your hosting plan). If you don’t know the details of your cPanel login then ask your hosting provider.



Step 1) Access Your MySQL Database

  • Log into your cPanel/Control panel
  • Go to “Database” section
  • Click on PHPMyAdmin icon
PHPMyAdmin access

Step 2) Go to the WP Users table

  • Select your WordPress database from the list of databases in PhpMyAdmin
  • Go to the WP Users table and click on the “insert” link
wp users database table

Step 3) Insert a New Record in the Users Table

You will need to fill in the following fields to insert a new user record:

  • ID – Keep the value of this field empty (it will automatically assign the correct value for it)
  • user_login – insert the username you want to use
  • user_pass – add a password for the account. Select MD5 in the functions menu (Refer to the screenshot below).
  • user_nicename – leave this field empty for now
  • user_email – add the email address you want to use for this account.
  • user_url – leave this field empty for now
  • user_registered – select the date/time for when this user is registered.
  • user_status – set this to 0.
  • display_name – leave this field empty for now
  • Click on the Go Button (you should see a success message)
insert a new wp user record screenshot

You can go back to the wp_users table and browser the entries to verify that the user record has been inserted correctly (see screenshot below).

inserted wp user record screenshot

Take note of the value if the “ID” field for this newly created user (we will need this ID field’s value for the next step). In this case the ID is 2.

Step 4) Insert User Meta Values

This is the final step where we will assign some user meta values to the user account we just created.

Go to the “wp_usermeta” table and click on the “insert” link:

wp usermeta table screenshot

Use the following values and click the “Go” button to insert the usermeta data

  • umeta_id – Leave it blank (it will be generated for you)
  • user_id – This is the ID of the user we created in the previous step. For our case it is 2.
  • meta_key – Use wp_capabilities
  • meta_value – Use the following value for this field:
a:1:{s:13:"administrator";s:1:"1";}

See screenshot below

wp usermeta data screenshot

All done!

You can now log into your WP site using this newly created WP User account. You can use this account to change the password and role of your other user accounts or delete them (if you want to).

Related Posts

  • How to import WordPress SQL database backup file without having ‘create new database’ privileges in phpMyAdmin
  • How to Install WordPress on Your Domain
  • How To Create an Attractive Subscribe & Follow Box For Your WordPress Blog
  • How to Use the FileZilla FTP Client for Your WordPress Site

Web Development,  Wordpress Blog Setup,  Site admin tips,  Troubleshooting,  wordpress blog

Reader Interactions

Comments (5 responses)

  1. Jan Koch says:
    November 29, 2018 at 2:45 am

    I think you’re missing updating the “wp_user_level” user meta key for that user. I had to set that to “10” in order to get it to work.

    Like so:
    INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, ‘your_user_id’, ‘wp_user_level’, ’10’);

    Best,
    Jan

  2. Ian Gillard says:
    July 28, 2018 at 10:35 am

    Thank You so much for your help. I might of had some chance to figure this out if I had time but the Meta_Value is priceless information. Your the best!

  3. Rick says:
    August 5, 2017 at 10:13 pm

    You rock….thanks so much this just saved me. Thank You!

  4. Paal Joachim Romdahl says:
    August 5, 2017 at 10:20 am

    My work around was to change the password of one of the old users. I was then able to login as them and check the user I had created. I noticed that under role for my new user it said none. I changed it to administrator and then logged out and in as the new user. This time it worked.

  5. john rook says:
    April 28, 2015 at 10:45 am

    The above worked till I tried to login and failed with: a:1:{s:13:”administrator”;s:1:”1″;}

    My work around was to use this instead: a:1:{s:13:”administrator”;b:1;}

    Thanks all the same!

Leave a Reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Featured & Popular Articles

Video Answers to Top WordPress QuestionsWordPress Optimization Tips and Tricks for Better Performance and SpeedEssential WordPress Security Tips - Is Your Blog Protected?WordPress Simple PayPal Shopping Cart PluginTop 15 Search Engine Optimization (SEO) Techniques I Forget to DoList of the Best and Must Use WordPress PluginsHow do I Start a Blog and Make Money Online?Good Domain Name Picking Tips for Your Blog SetupFind Out Which WordPress Web Hosting Company Offers the Cheapest and Reliable Web Hosting Solution

Featured WordPress Plugins

WP Express Checkout Plugin
wordpress estore plugin
wordpress membership plugin
wordpress affiliate plugin

Recent Posts

  • How to Use Browser Developer Tools to Inspect Elements and [...]
  • Accept Donations via PayPal from Your WordPress Site Easil [...]
  • Buy Now Button Graphics for eCommerce Websites [...]
  • Subscription Button Graphics for eCommerce Websites [...]
  • Adding PayPal Payment Buttons to Your WordPress Sidebar Ea [...]

Comment & Socialize

  • @Rob, We have just released ...
    - admin
  • I installed the plugin a co ...
    - Rob
  • @Sebastian, We've released ...
    - admin
  • I've used this plugin on a ...
    - Sebastian Djupsjöbacka
  • @John, this plugin doesn't ...
    - admin

Check out our solutions

View our WordPress plugin collection and start using them on your site.

Our WordPress Solutions

Footer

Company

  • About
  • Privacy Policy
  • Terms and Conditions
  • Affiliate Login

Top WordPress Plugins

  • Simple Shopping Cart
  • PayPal Donations
  • WP Express Checkout
  • WP eStore
  • WP eMember

Blogging Tips

  • How to Start a Blog
  • Selecting a Good Domain
  • Cheap WP Hosting
  • WP Video Tutorials
  • Simple SEO Tips

Search


Keep In Touch

Copyright © 2025 | Tips and Tricks HQ