With programs such as WordPress, you need a login name to enter the administrative area. This is initially created during the installation of the program. However, there can be times when the admin account gets corrupted ore deleted by various means. In cases like this, you will need to add a new admin account to the database in order to be able to log in again. This cannot be done during normal means and will require that you do so by inserting the information into the database itself. Follow the guide below as we explain how to create a new admin account with SQL via the phpMyAdmin tool.

How to add an new admin account with SQL

  1. First, log into your cPanel dashboard.
     
  2. click the phpmyadmin toolOnce you are on the main cpanel page, locate the Databases category. From there, click on the icon entitled phpMyAdmin.
     
  3. This takes you to the phpMyAdmin main area. From the database menu in the left hand sidebar, find and click on your specific database for the installation you are working with. Follow these instructions to find out what database is the correct one if you do not know.
     
  4. Now that the information is loaded, you will need to find the tab named SQL from across the top of the page and click on it.
     
  5. click go buttonNext, you will need to enter the code to create the new admin account. The code below will create a new admin account with the username admin2 with the password newpass. The data that is colored in blue is meant for you to customize, but leave all the other code as it is written. Be sure to remember on the username and password you enter for your login.
    INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`)
    VALUES ('admin2', MD5('newpass'), 'firstname lastname', ' This email address is being protected from spambots. You need JavaScript enabled to view it. ', '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');
     
  6. Once your personal data is entered, click the Go button so the new row will be added.
     
  7. log in with new admin usernameIf you do not receive an error message, the data was inserted correctly. Now you can visit your wordpress admin login area using your new admin login information.
     

 

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
Email Address
Name

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Did you find this article helpful?

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Need More Help?

Help Center Search

Current Customers

Email: support@WebHostingHub.com Ticket: Submit a Support Ticket
Call: 757-416-6627 Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.
}