Friday, August 5, 2011

Database security - Solving the 'cannot connect to database' problem

Using the security console,

1. I changed the password for MySQL database.
2. I set the user name and password for the Xampp directory protection.

Afterwards, I could not access localhost in the browser.

The solution is to modify the configuration file, configuration.php-dist.


In htdocs/joomla_1_5_14 , open configuration.php-dist and save as configuration.php.

To edit the con figuration, open configuration.php in Dreamweaver or other text editor.

See Lines 39 to 48.

Because I have changed the user names and passwords, I need to make changes to the configuration file, as follows:




* Database configuration section
* -------------------------------------------------------------------------
*/
/* Database Settings */
var $dbtype = 'mysql'; // Normally mysql
var $host = 'localhost'; // This is normally set to localhost
var $user = 'root'; // MySQL username
var $password = '#########'; // MySQL password , not shown
var $db = 'joomla###'; // MySQL database name , not shown
var $dbprefix = 'jos_'; // Do not change unless you need to!


Save the file.
==========================

Try localhost. It works ! the page displays correctly.

So , after changing the user name and password etc, you must modify the configuration file accordingly.

No comments:

Post a Comment