OpenCart Admin Account from database

Here is how you can add an admin account to your Opencart 2.X store using phpMyAdmin/MySQL database. This guide would come handy if you are unable to add the administrator account from the OpenCart panel, or have forgotten your password. Also helpful if you’re an agency/developer and the customer hasn’t given you administrator access. If you feel your store has been hacked and that is why you are not able to access the dashboard, check critical signs of hacked websites.

  1. Log into your cPanel account/hosting administrator dashboard.
  2. In the cPanel main page, find the Databases category, and click on the phpMyAdmin tool icon.
  3. From the left sidebar, select the database name of your OpenCart installation. If you do not remember the name of your database, open the config.php which is in the root of your server and see the value of the variable DB_DATABASE.
  4. Once you open the correct database, click on the “SQL” tab at the top.
  5. Now enter the following SQL command in the SQL query editor. This query will create a new administrator account to the OpenCart store.Opencart 2.X Admin User Table - phpMyAdmin
    INSERT INTO oc_user VALUES
    (9999,1, ‘Username‘, MD5(‘admin_password’), ”, ‘FirstName‘, ‘LastName‘, ‘[email protected]‘, ”, ”, ‘0.0.0.0’,1,CURDATE());

    If you want to change the details of the user, modify the values in ‘FirstName‘, ‘LastName‘, and ‘[email protected]‘.

  6. Click on the Go button to run the query and add the new admin user in the database.
  7. You should now see the ‘successful query’ message, navigate to your OpenCart admin area and try logging in with the following user credentials:
    • Username: admin_user
    • Password: admin_password
  8. Once you login to the dashboard, immediately change your account password.

Popular CMSs like OpenCart are often targeted by hackers. To ensure utmost OpenCart Security, use Astra Security suite to protect your store and block hackers. Astra comes with a bulletproof Web Application Firewall (WAF), malware scanning, bad bot blocking and much more. See the list of all features here.

Waiting to Get Hacked?

Get security tips & latest vulnerability fixes right in your inbox:

About The Author

Ananda Krishna

Ananda is a security researcher at Astra.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close