When working with programs such as OpenCart, strange things can happen. At times, even unexplainable incidents such as disappearing admin accounts can occur. While this is a rare occurrence, and usually due to an accident while playing with the database, it can play havoc when trying to fix the issue. You would need to access the admin area to create or promote an account to the admin role. However, without an account to access the admin area, you are stuck. You need to have a plan for inserting an emergency admin account into your OpenCart application database. Below are the instructions for doing just that.
How to create an emergency admin account in OpenCart
- To begin, you will need to access your cPanel account.
- Entering at the cPanel main area, you will want to find the Databases category and then click on the phpMyAdmin tool icon.
- Once inside, look to the list of databases on the left. Find and click on the database for your OpenCart application. If you do not know which database is the one to use, you can find out using our article: Finding your OpenCart database name.
- Clicking on the database name brings up the specific information in the right hand panel. Across the top are several tabs, click on the SQL tab.
- This brings up the SQL query editor where we will enter the code to create an admin account in the database. Below is the code you want to cut and paste into the query editor:
INSERT INTO oc_user VALUES
(9999,1, 'admin123', '21232f297a57a5a743894a0e4a801fc3', '',
'firstname', 'lastname', '
This email address is being protected from spambots. You need JavaScript enabled to view it.
', '',
'0.0.0.0',1,CURDATE());
Although you can edit the fields with 'firstname','lastname', and '
This email address is being protected from spambots. You need JavaScript enabled to view it.
' to be real names and email, do not edit any other fields. Click GO at the lower right corner to run the code and add it to the database.
- You will see a success message once the process is complete. You can now log into the admin area of your OpenCart with the username 'admin123' and the password 'admin'.
We value your feedback!
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.
new! - Enter your name and email address above and we will post your feedback in the comments on this page!