coppermine-gallery.com/forum

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Installation & Setup => Topic started by: MSOWebGirl on January 05, 2005, 05:57:46 AM

Title: Can not connect after installation
Post by: MSOWebGirl on January 05, 2005, 05:57:46 AM
I have performed a search for this error, and I none of these tips are helping.  I have Coppermine installed on two separate servers.  On the first, I have been using it for a few months and it suddenly developed problems.  I installed that through Fantastico and am waiting for a reply from my server (based on a comment from someone with the same upload problem).  My other gallery is on a different server that does not have Fantastico.  I installed this one manually.  It said that the install was successful, but when I try to go to the index page, I get the following error:

Coppermine critical error:
Unable to connect to database !

MySQL said: Access denied for user: 'www-data@localhost' (Using password: NO)

I don't understand why this is happening.  I saw that another poster with this similar issue was told to check his file include/config.inc.php and make sure that the information is valid.  I do not have this file.  The URL to the gallery is http://cgi.michael-shane.com/cpg132/index.php.    If someone can help me, I would greatly appreciate it.
Title: Re: Can not connect after installation
Post by: Tranz on January 05, 2005, 06:08:50 AM
Yes, you do have the file. I checked.

Look in the folder called include for a file named config.inc.php
Title: Re: Can not connect after installation
Post by: MSOWebGirl on January 05, 2005, 06:14:04 AM
My apologies.  I was looking in the wrong spot.  I looked in this file and all of the information in it is correct.  The username, password, and database are all correct.  Am I missing something somewhere else that is stopping it from connecting? 

Thanks.
Title: Re: Can not connect after installation
Post by: Abbas Ali on January 05, 2005, 12:29:01 PM
QuoteMySQL said: Access denied for user: 'www-data@localhost' (Using password: NO)

This error denotes that you are not using password to connect to the database. Make sure that you have correct password

$CONFIG['dbpass'] = "password"

written in config.inc.php
Title: Re: Can not connect after installation
Post by: MSOWebGirl on January 06, 2005, 05:00:04 AM
I checked and the password is correct.  I cross-checked it with  my information at my server, and everything is alright.  I don't know why I'm getting that error.
Title: Re: Can not connect after installation
Post by: kegobeer on January 06, 2005, 05:14:46 AM
In init.inc.php, right before

require 'include/functions.inc.php';

add this

echo "server: " . $CONFIG['dbserver'] . "<br />dbuser: " . $CONFIG['dbuser'] . "<br />dbpass: " .$CONFIG['dbpass'] . "<br />dname: " . $CONFIG['dbname']";
die();


Do you get the correct values?
Title: Re: Can not connect after installation
Post by: MSOWebGirl on January 06, 2005, 05:26:39 AM
Now I got the following error message:

Parse error: parse error, expecting `','' or `';'' in /var/www/sites/michael-shane.com/cpg132/include/init.inc.php on line 223

Fatal error: Call to undefined function: breadcrumb() in /var/www/sites/michael-shane.com/cpg132/index.php on line 159
Title: Re: Can not connect after installation
Post by: Abbas Ali on January 06, 2005, 12:25:25 PM
Instead of

Quote from: kegobeer on January 06, 2005, 05:14:46 AM

echo "server: " . $CONFIG['dbserver'] . "<br />dbuser: " . $CONFIG['dbuser'] . "<br />dbpass: " .$CONFIG['dbpass'] . "<br />dname: " . $CONFIG['dbname']";
die();



you should write this code

echo "server: " . $CONFIG['dbserver'] . "<br />dbuser: " . $CONFIG['dbuser'] . "<br />dbpass: " .$CONFIG['dbpass'] . "<br />dname: " . $CONFIG['dbname'];
die();


And see whether the values match or not..
Title: Re: Can not connect after installation
Post by: kegobeer on January 06, 2005, 03:02:58 PM
Sorry about that last ".  Hey, it was late at night when I wrote it!   ;D
Title: Re: Can not connect after installation
Post by: MSOWebGirl on January 07, 2005, 02:15:48 AM
Okay, so either I'm still doing something wrong, I'm extremely slow, or both.  Now, all I'm getting is a white page that tells me the information that I put in the fields.
Title: Re: Can not connect after installation
Post by: kegobeer on January 07, 2005, 03:11:02 AM
That was the intent.  I wanted to make sure that the fields were correctly populated.  You can remove that line.

Create a new php file with this code:

<?php
$localhost 
'your host name';
$mysql_user 'your mysql user name';
$mysql_password 'your mysql password';
$mysql_database 'your mysql database name';

$link mysql_connect($localhost$mysql_user$mysql_password);
if (!
$link) {
   die(
'Could not connect: ' mysql_error());
}
echo 
'Connected successfully<br />';

$db_selected mysql_select_db($mysql_database$link);
if (!
$db_selected) {
   die (
'Can\'t use ' $mysql_database ': ' mysql_error());
}
mysql_close($link);
?>


Put your database information in the variables.  Upload it to your site and execute the script.  Report back with your results.
Title: Re: Can not connect after installation
Post by: MSOWebGirl on January 12, 2005, 01:35:25 AM
I loaded the file and it said, "Connected successfully."  I apologize that it took me so long to get back to you.  I got some bad news on Saturday, and I've been a bit behind on everything. 
Title: Re: Can not connect after installation
Post by: Abbas Ali on January 12, 2005, 06:44:57 AM
This means that you are able to connect to the database and all the parameters supplied by you are correct. So what could be the problem  ??? ::).

First make a backup of include/functions.inc.php then open include/functions.inc.php file and find this code

function cpg_db_connect()
{
        global $CONFIG;
        $result = @mysql_connect($CONFIG['dbserver'], $CONFIG['dbuser'], $CONFIG['dbpass']);
        .........
       


and replace it with this code

function cpg_db_connect()
{
        global $CONFIG;
        echo "server: " . $CONFIG['dbserver'] . "<br />dbuser: " . $CONFIG['dbuser'] . "<br />dbpass: " .$CONFIG['dbpass'] . "<br />dbname: " . $CONFIG['dbname'];
        $result = @mysql_connect($CONFIG['dbserver'], $CONFIG['dbuser'], $CONFIG['dbpass']);
        .......


and see whether you get the correct values or not. Check whether dbpass value is correct.
Title: Re: Can not connect after installation
Post by: PTWebMiss on March 15, 2005, 11:05:55 PM
Hi, this is the same person, MSOWebGirl.  I had some issues finding my password and such, so it was just easier to make a new one.  Okay... here's the thing.  I've gone back to trying to install this gallery because others were giving me just as many problems and I've liked Coppermine when I used it in the past.  I tried the last thing that was requested for me to do, altering /include/functions.inc.php and all I got when I loaded it up was a blank page.  I've reinstalled the script and the installation went just fine, but I still get the exact same connection error as I was getting before.  I don't know what I'm doing wrong.
Title: Re: Can not connect after installation
Post by: kegobeer on March 16, 2005, 03:07:29 AM
Hmm.  That's odd.  You shouldn't get a blank page if all you did was replace

        $result = @mysql_connect($CONFIG['dbserver'], $CONFIG['dbuser'], $CONFIG['dbpass']);

with

        echo "server: " . $CONFIG['dbserver'] . "<br />dbuser: " . $CONFIG['dbuser'] . "<br />dbpass: " .$CONFIG['dbpass'] . "<br />dbname: " . $CONFIG['dbname'];
        $result = @mysql_connect($CONFIG['dbserver'], $CONFIG['dbuser'], $CONFIG['dbpass']);


You should get four lines printed at the top left corner of your page.