phplist error "Cannot connect to database"

Web hosting discussion, programming, and shared and dedicated servers.
2 posts Page 1 of 1
by jeffryf » Tue Dec 13, 2011 4:11 pm
I've been using phplist for several years. I use it once each week to send email to about 2000 addresses. Last week it worked fine as usual. This week I'm unable to sign into my admin control panel but instead get the following message:
1. Cannot connect to Database, please check your configuration

I understand that what has happened in between is a change in mySql.

The error message is generated from the following code located at the top of mysql.inc. The variables are defined in a config.php file--which hasn't changed. I suspect I need to specify one of these variables differently. I'd appreciate some help figuring out how.

function Sql_Connect($host,$user,$password,$database) {
if ($host && $user)
$db = mysql_connect($host , $user ,$password );
$errno = mysql_errno();
if (!$errno) {
$res = mysql_select_db($database,$db);
$errno = mysql_errno();
}
if ($errno) {
switch ($errno) {
case 1049: # unknown database
Fatal_Error("unknown database, cannot continue");
exit;
case 1045: # access denied
Fatal_Error("Cannot connect to database, access denied. Please contact the administrator");
exit;
case 2002:
Fatal_Error("Cannot connect to database, Sql server is not running. Please contact the administrator");
exit;
case 1040: # too many connections
Fatal_Error("Sorry, the server is currently too busy, please try again later.");
exit;
case 0:
break;
default:
SQL_Error($errno, "Server error:". mysql_error());
}
print "1. Cannot connect to Database, please check your configuration";
exit;
}
if (!$db) {
print "2. Cannot connect to Database, please check your configuration";
exit;
}
if (strcasecmp($GLOBALS['strCharSet'], 'utf-8') == 0) {
mysql_query ("SET NAMES 'utf8'");
}
return $db;
}
by jeffryf » Mon Dec 19, 2011 10:02 am
Problem solved. I needed to prefix database name in the config file.
2 posts Page 1 of 1

Who is online

In total there are 29 users online :: 1 registered, 0 hidden and 28 guests (based on users active over the past 5 minutes)
Most users ever online was 999 on Mon May 10, 2021 1:02 am

Users browsing this forum: Google [Bot] and 28 guests