Opencart Security

How to add an admin account in OpenCart 2.X via MySQL & phpMyAdmin

Updated on: March 29, 2020

How to add an admin account in OpenCart 2.X via MySQL & phpMyAdmin

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
    (9999,1, ‘Username‘, MD5(‘admin_password’), ”, ‘FirstName‘, ‘LastName‘, ‘[email protected]‘, ”, ”, ‘’,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.

Tags: , ,

Ananda Krishna

Ananda Krishna is the co-founder & CTO of Astra Security, a SaaS suite that secures businesses from cyber threats. He has been acknowledged by the Indian Navy, Microsoft, United Airlines, etc. for finding critical security vulnerabilities in their systems. Winner of the Best Security Product at Global Conference on Cyberspace 2017 (awarded by Narendra Modi, Prime Minister of India) & French Tech Ticket, Paris (awarded by François Hollande, former President of France). At Astra he's building an intelligent security ecosystem - web application firewall (WAF), malware detection & analysis, large scale SaaS applications, APIs & more. He's actively involved in the cybersecurity community and shared his knowledge at various forums & invited talks.
Notify of

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

Inline Feedbacks
View all comments

Psst! Hi there. We’re Astra.

We make security simple and hassle-free for thousands
of websites and businesses worldwide.

Our suite of security products include a vulnerability scanner, firewall, malware scanner and pentests to protect your site from the evil forces on the internet, even when you sleep.

earth spiders cards bugs spiders

Made with ❤️ in USA France India Germany