Solved

Resetting a password for admin in PHP

Posted on 2014-04-02
9
583 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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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 …

734 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