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.
- Log into your cPanel account/hosting administrator dashboard.
- In the cPanel main page, find the Databases category, and click on the phpMyAdmin tool icon.
- 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.
- Once you open the correct database, click on the “SQL” tab at the top.
- Now enter the following SQL command in the SQL query editor. This query will create a new administrator account to the OpenCart store.INSERT INTO oc_user VALUES
(9999,1, ‘Username‘, MD5(‘admin_password’), ”, ‘FirstName‘, ‘LastName‘, ‘email@example.com‘, ”, ”, ‘0.0.0.0’,1,CURDATE());
If you want to change the details of the user, modify the values in ‘FirstName‘, ‘LastName‘, and ‘firstname.lastname@example.org‘.
- Click on the Go button to run the query and add the new admin user in the database.
- 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
- 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.