Forgotten Your Admin Password? Shock, Horror!

Early releases of osCommerce didn't have any protection for the Admin area – it was up to the Shop Owner to protect the Admin folder using .htaccess…easy enough in most hosts Control Panels. And easy enough to reset if you forgot the Password…
Jon sent in an interesting dilemma;
When I set up oscommerce the install asked me for a admin username and password, when I came back to the site a week later to do some work I cannot remember the Password that i used. Can you help?
RC (recent) releases of osCommerce include an inbuilt password – so the installation procedure asks for a Username and Password. If you forget your Password, it's impossible to get it back, as it is entered into the MySQL Database encrypted.
BUT…it is easy to get around, so long as you have access to PHP My Admin (which is standard on just about every host that I know of!). Here's what you need to do.
1. Open up PHP My Admin, and EMPTY the Administrators Table totally.
2. Go to your Shop Admin, and the login page will now ask you to set up a NEW admin username and password. It will show this text "No administrators exist in the database table. Please fill in the following information to create the first administrator. (A manual login is still required after this step)". Obviously, you should follow this instruction!
3. You can now log in using your new username and password.
Easy as 123. Here's a video I made of me doing exactly these steps;





Thank You for the help
Comment by Web Design Wexford — April 14, 2008 @ 6:39 pm
You are welcome.
Comment by Gary — April 14, 2008 @ 7:40 pm
We have approx. 13 os stores. When going through the php my admin, only some of the os stores display a "administrators table"? Any thoughts/help?
Comment by andy — July 6, 2008 @ 4:08 pm
Andy – only newer oscommerce sites that use "RC" releases of osCommerce would have the administrators table. Older version would use standard .htaccess to secure the admin folder – so if you have cPanel (or similar hosting control panel) you'd set it up in that…
Comment by Gary — July 6, 2008 @ 4:29 pm
we do have cpanel – please direct me if you would on how to change passwords for OS sites on the older versions.
Comment by andy — July 6, 2008 @ 4:33 pm
we do have cpanel – please help me if you would on how to change passwords for OS sites on the older versions via cpanel navigation.
Comment by andy — July 6, 2008 @ 4:35 pm
Andy – read your hosts help files or open a support ticket with them.
Comment by Gary — July 7, 2008 @ 7:06 am
Ahhhh exactly what I was looking for. There was another post showing a more complicated way of replacing the old password with a new one, this was 1 click and BAM..
Thx!
Comment by Kevin — July 19, 2008 @ 9:24 pm
Brilliant!
Just what I needed, thanks a million!
Comment by Dave — January 5, 2009 @ 12:44 pm
Excellent!!!
Obviously it's very simple! The video is really helpful
Comment by Andreas — April 13, 2009 @ 2:34 am
AArrgg.
Just deleted the administrators table not the contents.
What a twat.
BUT had the foresight to export the table first so just looked at the contents in Textpad
and manually repaired administrators table then able to input new name and password.
Phew. Double phew.
Anyway thanks Gary.
But it had taught me how easy it is to change a DB structure and you should protect ANY access to the oscommerce DB rigorously.
Cheers
Comment by Trev — July 22, 2009 @ 10:27 am
Trev – as you rightly say, it's very easy for it all to go wrong when playing with the DB. Always, always, make a backup.
Comment by Gary — July 22, 2009 @ 1:54 pm
Thanks A million, iv been pulling my hair out for the past 2 hours. your a life saver
Comment by Graham — October 14, 2009 @ 9:19 pm
Really thanks +10
Comment by djairo — November 12, 2009 @ 8:16 am
Thanks! this works on the latest osc 2.3.1 also.
Comment by Karlos — November 23, 2010 @ 2:24 am