By: Michael Phipps
3 Jul 2009Requirements: Must have ADMIN access to the Drupal site
If you are in the situation where you have misplaced the login details for the database that powers your drupal installation, here’s how you *might* be able to get them:
<?php
echo file_get_contents(dirname(__FILE__)."/../sites/default/settings.php");
?>
$db_url = 'mysql://[username]:[password]@localhost/[databasename]';
where username, password and databasename contain the information you are looking for
With luck, you’ve got the informaiton you wanted.
It is very common, particularly in sites powered by cPanel for the username and password of the database to be the same as the ftp login details of the website, so if you have misplaced the ftp login details for the website, you might find they are the same as the database login details.