[thelist] Mysql connection failed

Santilal Parbhu santilal at scorpioneng.co.nz
Wed Nov 14 14:18:55 CST 2007


Hi

 

This is a very unusual query.  I have been building a PHP & Mysql
application and testing it on a Abria Merlin platform using PHP 4.0.4 and
Mysql 3.23.22-beta with an Apache 1.3 server.  The development has been
going fine and I have been using it successfully for about 18 months.  After
some minor tweaking (mostly HTML tidy-ups and improving security) I have
found that on some occasions I can't connect to the database.  On other
occasions, I can, even though there have been no changes in-between.
Weird!!

 

This is the error I get: (I am printing out the host name, username and
password for debugging purposes).

 

"Warning: MySQL Connection Failed: Access denied for user
'admin'@'localhost' (using password: YES) in mysqlconnect.php on line 12
localhost, admin, access

 

 

The script is:

 

<?php 

// This script connects to the MySQL server.

// This script also selects the database.

 

// Address error handling.

ini_set ('display_errors', 1);

error_reporting (E_ALL & ~E_NOTICE);

include ('databaseParameters.php');

// Attempt to connect to MySQL and print out messages.

 

 

if ($dbc = mysql_connect ($hostName, $dbUserName, $dbPassword)) {

            

            if (mysql_select_db ($databaseName)) {

                        

            } else {

                        die ('<p>Could not select the database because: <b>'
. mysql_error() . </b></p>');

            }

            

            //mysql_close(); // Close the connection.

 

} else {

            print "$hostName, $dbUserName, $dbPassword";

            die ('<p>Could not connect to MySQL because: <b>' .
mysql_error() . '</b></p>');

 

}

 

?>

 

The script that holds the parameters is:

 

<?php

//This is where the database parameters are set.

$hostName = "localhost";

$databaseName = "gamedata";

$dbUserName = "admin";

$dbPassword = "access";

$compnotices = "demonotices";

$compdraw = "demodraw";

$comppoints = "demopoints";

$compteams = "demoteams";

$comptemp = "demotemp";

$compusers = "demousers";

$compgrades = "demorevampgrades";

?>

 

I have even tried accessing the database directly using MysqlMan, but this
failed too.  It is as though the database is not recognizing the username
and password, but I have successfully used these before.

 

Does anyone know a way to get into the database through a back-door so I can
see what is happening?

 

Thanks.  Oh and I an using Windows XP Pro.

 

 

 

Santilal Parbhu

 




More information about the thelist mailing list