Views: 238 visits
Create WordPress Admin via phpMyAdmin

If you ever find yourself locked out of your WordPress admin panel due to various reasons—such as corrupted site code, security settings, or unknown issues—and even password recovery doesn’t work, don’t worry!

You can easily create a new admin user in WordPress using phpMyAdmin and regain access to your website’s dashboard. In this guide, we’ll walk you through the process step by step.


Steps to Create an Admin User in WordPress via phpMyAdmin

🔹 Note: This guide assumes that the default database table prefix is wp_. If your prefix is different, make sure to update the SQL queries accordingly.

Step 1: Access phpMyAdmin

  1. Log in to your hosting control panel (cPanel or DirectAdmin).
  2. Navigate to the Databases section.
  3. Click on phpMyAdmin to open it.

Step 2: Select the Correct Database

  1. On the left sidebar, you’ll see a list of available databases.
  2. If you’re unsure which database is associated with your WordPress site, check your wp-config.php file (located in the root directory of your website) to find the database name.
WordPress Admin Creation Using phpMyAdmin
Creating an Admin User in WordPress via phpMyAdmin – image1

Step 3: Open the SQL Query Tab

  1. After selecting the database, click on the SQL tab in the top navigation bar.
  2. A text box will appear where you can enter SQL queries.
Add Admin User in WordPress via phpMyAdmin
Creating an Admin User in WordPress via phpMyAdmin – image2

Step 4: Execute the SQL Commands to Create an Admin User

Copy and paste the following SQL commands into the query box. Replace the placeholders with your desired values:

INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`)
VALUES ('newadmin', MD5('1213123'), 'firstname lastname', '[email protected]', '0');
 
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) 
VALUES (NULL, (Select max(id) FROM wp_users), 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');
 
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) 
VALUES (NULL, (Select max(id) FROM wp_users), 'wp_user_level', '10');

🔹 Explanation:

  • Replace 'newadmin' with your preferred admin username.
  • Replace '1213123' with your chosen password (it will be stored in MD5 encryption).
  • Replace '[email protected]' with your actual email address.

Step 5: Save the Changes

Once the SQL queries are entered, click GO to save the new admin user to the database.

Create Admin Account in WordPress Database
Creating an Admin User in WordPress via phpMyAdmin – image3

Step 6: Log into WordPress Admin Panel

Now, you can log into your WordPress dashboard using the newly created admin credentials.


Important Notes

✅ This guide is designed for cPanel hosting, but the same steps apply to DirectAdmin.
✅ If you face any issues, feel free to reach out via support tickets or live chat for assistance.

We hope this guide was helpful. Good luck! 🚀

Read more