Solved

Resetting a password for admin in PHP

Posted on 2014-04-02
9
595 Views
Last Modified: 2014-04-28
Hi, we have a PHP intranet site at work, whose admin password is lost, it was build in php and mysql, hosted on Linux, all we have is a root password for Linux, so how can we reset the password for the portal which is hosted on our intranet site?
0
Comment
Question by:Leo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 2

Expert Comment

by:Puspharaj Selvaraj
ID: 39974264
Sure, you can reset the password.

reset the password via mysql like this

http://askubuntu.com/questions/321903/resetting-forgotten-phpmyadmin-password
0
 
LVL 35

Expert Comment

by:Dan Craciun
ID: 39974316
That's if your intranet site uses phpmyadmin. If not, use the steps from above to reset mysql root password, then drop Adminer somewhere in your html path and navigate to the page.

Put root and your new password in the Adminer login page, then identify what database is your application using, then identify it's user's table and then modify/add users and passwords.

HTH,
Dan
0
 
LVL 57

Expert Comment

by:Julian Hansen
ID: 39974406
When you say admin password - do you mean the password to the database ro the password to access the system?

If PHP is accessing the database then a user name and password used by the PHP script should be available somewhere in the code - a config file etc.

This will allow you to access the databse.

If your app manages its own security and you are looking for the admin password to the application - i.e. stored in a user table in the database then you can use the credentials as obtained above and use them to access the table where the passwords are stored.

You can then simply (depending on how passwords are stored) enter a new password.

If the password is hashed or encrypted - you can look at the PHP code to see how it is encrypting the password and replicate that process when creating a new value.

If you are wanting to reset the root password to the MySQL database you can find out more on how to do this here

https://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 8

Author Comment

by:Leo
ID: 39990861
When i say database, i mean username/password to access the web portal on intranet.
On Centos when i enter the command mysql ( to connect to DB to access tables) i get an error 1045 message: Access Denied for user `root1@`localhost` (using password:NO).
Do i have to use different login details to access mysql db?
0
 
LVL 57

Expert Comment

by:Julian Hansen
ID: 39990902
If you don't have the login details - or they are not working then the link in my previous post is the one to look at.

Are you sure root1 exists on the database? default is root?
0
 
LVL 8

Author Comment

by:Leo
ID: 39990918
Those instructions are for windows box, i am running linux through cli...would the same instructions work?
so on centos iam logged in as root. Sorry that was a typo, in the error message its root@,
i have the root password for mysql, but how i should access mysql DB? when i type in #mysql, it gives an error which i posted, is there a different way of connecting to mysql database in centos?
0
 
LVL 8

Accepted Solution

by:
Leo earned 0 total points
ID: 40019242
have resolved the question by myself.
https://www.phpbb.com/community/viewtopic.php?f=46&t=1252135
0
 
LVL 35

Expert Comment

by:Dan Craciun
ID: 40019247
Damn that crystal ball is late in coming. We should of known you're using phpBB, it was so obvious from your post...
0
 
LVL 8

Author Closing Comment

by:Leo
ID: 40026813
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

729 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