Reset website's admin account password through cpanel or phymyadmin

Posted on 2011-04-19
Last Modified: 2012-05-11
I am the sole administrator of a small website I had built for me a few months ago. I have full access to the cpanel and can view all the data in the database through phpmyadmin with no problem.

This website has one admin user registration, in a separate table from the other user registrations. Unfortunately I haven't logged into the site (as opposed to cpanel) for ages and I now cannot remember the password for this admin account. The specific reason I need to have this password is that there is a user interface with the admin account that means I can manage the site directly rather than through the database. I do not know what email address the web developer used to set up the admin account so I cannot have the password resent, and I cannot currently ask him.

Is there a way I can either reset the password for the admin account through cpanel or phpmyadmin, or add a new admin user with a password I select?

I have tried going in phpmyadmin to the table with the admin user in it, and inserting a new admin user with username admin2, password 'admin2password', setting the function of the password as MD5 and adding this new user, but going to the site and trying to log in with admin2/admin2password does not work.

Thanks in advance.
Question by:cidlockie
    LVL 13

    Expert Comment

    Can you see the table that holds the old admin? Can you see any of the PHP code?

    Normally you'd be able to query the table and see what email was used.. Also although I hope it isn't the admin account could be hardcode to row one or something silly..

    Author Comment

    I can see the table with this admin in it yes. It has one user in it, this admin user. It has a user ID of 1, a column called 's_email' which doesn't have an email address in it, it has the admin account name, and the password column which has a load of random characters in it (that I now think are SHA1 rather than MD5).

    Can I query that table then? I don't know how to do that.
    LVL 13

    Expert Comment

    You could do the following

    Change the id to 9
    insert a new row id 1
    1 Empty password
    2 password function phpmyadmin
    3 Md5
    4 sha1

    Author Comment

    I don't really understand what you mean after the first part. I have made the current admin id 9, added a new admin2 with id 1, with an empty password. I then tried to change the function to PASSWORD, then to MD5, and then to SHA1, and in each case tried to log into the site with an empty password field, but none of them has worked.

    If that's what you meant for me to do it hasn't worked, if not I need it explained a bit better I think.
    LVL 13

    Accepted Solution

    Ok I was suggesting to try first with an empty password

    Then fill in password test and set the field to password in the edit form in phpmyadmin

    Try again
    Etc . So when encrypted use a password.

    If that don't work you might want to check some of the code .. Also make sure all other fields are filled like the admin account.

    Author Closing Comment

    Aha! Yes!

    That's worked with the test password and the function as SHA1 and it's let me in. I don't know what changing the ids did but that must have helped as I tried this before and it wasn't having it.

    Thanks pnuts!
    LVL 13

    Expert Comment

    No problem .. The person who build it probably did sone hardcoding for whatever silly reason.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    The viewer will learn how to dynamically set the form action using jQuery.
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now