Problem:
------------------------------------------------------------------------------------
Quote
No database made.
Warning: mysql_connect(): Access denied for user: 'fubar_admin@localhost' (Using password: YES) in /nfs/home/fubar/public_html/pnadodb/drivers/adodb-mysql.inc.php on line 320
Error connecting to DB
Program: /nfs/home/fubar/public_html/install/db.php - Line N.: 45
Database: PostNuke
Error (1045) : Access denied for user: 'fubar_admin@localhost' (Using password: YES)
Info - Excerpt from my web hosts cPanel X - MySQL Account Maintenance:
------------------------------------------------------------------------------------
Databases: fubar_postnuke
Users in PostNuke
fubar_cmsadmin (Privileges: ALL PRIVILEGES)
Connection Strings
PHP $dbh=mysql_connect ("localhost", "fubar_admin", "<password here="here">") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("fubar_postnuke");</password>
------------------------------------------------------------------------------------
Resolve thus far:
I have read the FAQ and other messages covering topics close to this problem, but nothing explains what to do NEXT, if all if correct and all worked before and with other older code. Can anyone help?
Update / My Fix:
I looked at the db.php and on line 45 and such, I hard coded the variables and it worked. So it seems a variable is losing its contents somewhere from 60% - this point. The function reads:
------------------------------------------------------------------------------------
Orignal Code
------------------------------------------------------------------------------------
Code
function dbconnect($dbhost, $dbuname, $dbpass, $dbname, $dbtype = 'mysql')
{
$connectString = "$dbtype://$dbuname:$dbpass@$dbhost/$dbname";
global $ADODB_FETCH_MODE;
$dbconn = &ADONewConnection($dbtype);
$dbh = $dbconn->Connect($dbhost, $dbuname, $dbpass, $dbname);
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
// if we get an error, log it and die
if ($dbh === false) {
error_log ("connect string: $connectString");
error_log ("error: " . $dbconn->ErrorMsg());
// show error and die
PN_DBMsgError($dbconn, __file__ , __line__, "Error connecting to db");
} else {
return $dbconn;
}
}
{
$connectString = "$dbtype://$dbuname:$dbpass@$dbhost/$dbname";
global $ADODB_FETCH_MODE;
$dbconn = &ADONewConnection($dbtype);
$dbh = $dbconn->Connect($dbhost, $dbuname, $dbpass, $dbname);
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
// if we get an error, log it and die
if ($dbh === false) {
error_log ("connect string: $connectString");
error_log ("error: " . $dbconn->ErrorMsg());
// show error and die
PN_DBMsgError($dbconn, __file__ , __line__, "Error connecting to db");
} else {
return $dbconn;
}
}
------------------------------------------------------------------------------------
Changed Code
------------------------------------------------------------------------------------
Code
function dbconnect($dbhost, $dbuname, $dbpass, $dbname, $dbtype)
{
$dbtype = "mysql";
$dbhost = "localhost";
$dbuname = "fubar_admin";
$dbpass = "password";
$dbname = "fubar_admin";
$connectString = "$dbtype://$dbuname:$dbpass@$dbhost/$dbname";
global $ADODB_FETCH_MODE;
$dbconn = &ADONewConnection($dbtype);
$dbh = mysql_connect ($dbhost, $dbuname, $dbpass, $dbname);
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
// If we Get an error, log it AND die
if ($dbh === false) {
error_log ("connect string: $connectString");
error_log ("error: " . $dbconn->ErrorMsg());
// show error AND die
PN_DBMsgError($dbconn, __file__ , __line__, "Error connecting to db");
} else {
return $dbconn;
}
}
{
$dbtype = "mysql";
$dbhost = "localhost";
$dbuname = "fubar_admin";
$dbpass = "password";
$dbname = "fubar_admin";
$connectString = "$dbtype://$dbuname:$dbpass@$dbhost/$dbname";
global $ADODB_FETCH_MODE;
$dbconn = &ADONewConnection($dbtype);
$dbh = mysql_connect ($dbhost, $dbuname, $dbpass, $dbname);
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
// If we Get an error, log it AND die
if ($dbh === false) {
error_log ("connect string: $connectString");
error_log ("error: " . $dbconn->ErrorMsg());
// show error AND die
PN_DBMsgError($dbconn, __file__ , __line__, "Error connecting to db");
} else {
return $dbconn;
}
}
