Portal Home > Knowledgebase > Articles Database > MySQL Password


MySQL Password




Posted by JordanC26, 04-03-2009, 07:06 AM
I am transfering my database to a new host and well I need to create the same database (same name and username) along with the same password I used before (because a script im using is connected to it) then import the old .SQL files. However I dont know how I can find out the current password linked to that database (When you create one it asks you for a password remember?) Anyclue how to find it out? I cant change it I need to know what it is still. I am using cPANEL

Posted by LDHosting, 04-03-2009, 07:27 AM
Hey, If your script is using the database, is the password not written in your script (or it's configuration file)?

Posted by greg2007, 04-03-2009, 09:17 PM
I don't think there is any way to "recover" the password due to security reasons. You can easily assign a new one to the database, then as LDHosting says, the "script" must surely have the password stored somewhere. It's a bad script if you cannot change/edit/update configuration settings such as passwords. I don't know of any script or program that has a once-installed-no-return policy for passwords or access. Another option, is if you have any PHP files that access the database, website files etc, then there will be a file in your website folders that holds the database password.

Posted by Deem3n®, 04-04-2009, 10:08 AM
Search for something like config.php in your website files (typically it is public_html folder) and you sure will find the password for DB in it

Posted by greg2007, 04-04-2009, 11:56 AM
Not really. Anything in public_html is just relating to public server files for websites or other server stuff, nothing to do with databases. Unless, as mentioned, the website scripts (PHP etc) access the database, but then it could be named anything. "Usually" it's in an include folder and named something to do with db, such as "/includes/db_data.php" But it can be anywhere and named anything at all.

Posted by mindbend, 04-04-2009, 01:45 PM
If you have shell access and its a cpanel machine run the following: grep -li -R USERNAME_ * That will parse through all of your files for USERNAME_ which heads off all cpanel mysql accounts. Find that file and then you have your database credentials. grep -niC5 \ USERNAME_ FOUNDFILE Happy hunting!



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read

Language: