Errors in programs and databases can occur quickly and mysteriously. If something disasterous happens such as your admin account being deleted, it will seem imposible for your to fix as you need to get into the administrative area to troubleshoot or promote another user account to the Administrative role. In cases like this, you need to create an emergency admin account. This cannot be done through normal means and will need to be done with direct database interaction. Below is a guide on how to insert an admin account into your OpenCart 1.5 database.
- First, log into your cPanel account.
- From the main cPanel area, locate and find the Databases category, then click on the phpMyAdmin tool icon.
- Look to the left hand sidebar and click on the database name for your OpenCart installation. If you are unsure about the name, you can discover it by following these instructions.
- Once the database information loads into the right hand panel, look to the top tab menu, locate the SQL tab and click on it.
- Here is the SQL query editor. From here, we will enter some code that will create a new admin account for you. Below is the code to create a new admin account named admin123 and with the password admin.
INSERT INTO oc_user VALUES
(9999,1, ‘admin123’, ‘21232f297a57a5a743894a0e4a801fc3’, ”,
‘firstname’, ‘lastname’, ’email@example.com’, ”,
Feel free to change the ‘firstname‘, ‘lastname‘, and ‘firstname.lastname@example.org‘ data to anything you like as they should be obvious and are not crucial to getting you into the application. Do not change any of the other fields, however.
- Click on the Go button to activate the query and add the record.
- You will get a success message indicating the row was added. You can now test the user by logging into your OpenCart administrative area with the username admin123 and the password admin.