PDA

View Full Version : FATAL ERROR: Connection to database server failed


mzameeruddin
10-24-2009, 09:39 AM
hi Exprts
We are Using DotProject Applcation
with Apache 2.0.63
mySql 5.1.36
&php 5.2.11

it was working Well since 2 WEEKS,
now we are getting the Error

Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'localhost' (10055) in C:\wamp\www\lib\adodb\drivers\adodb-mysql.inc.php on line 354
FATAL ERROR: Connection to database server failed


Cud anybody please Help me out in Fixing the Error

many thanks
Zam

seco
10-24-2009, 09:56 AM
is this live on the net?

atheistrical
10-25-2009, 11:56 AM
It looks like the database variables are incorrectly set-up. Verify the database connection string that you have used to make the connection viz

1. Hostname
2. Username
3. Password
4. Port Number

It is a good practice to define these values globally in a separate file.

atheistrical
10-25-2009, 12:02 PM
Also, in PHP the typical connection string values are:


<?php
define("HOST","localhost");
define("USER","root");
define("PASSWORD","abc123");
define("DATABASE","test");
/* You need to assign the above values as provided by your web-host */


$con=mysql_connect(HOST,USER,PASSWORD) or die("Cannot connect to the database");
//**And in order to be able to work with a database, one must be chosen
$db=mysql_use_db(DATABASE);
?>


The above is a typical example. See if that helps!!

mzameeruddin
10-26-2009, 02:48 PM
It looks like the database variables are incorrectly set-up. Verify the database connection string that you have used to make the connection viz

1. Hostname
2. Username
3. Password
4. Port Number

It is a good practice to define these values globally in a separate file.

Hi thanks a lot for the Help
in Hostname i have Given "localhost"
username "root"
password Empty ""
portnumber it is left Empty!""

What Shuold i Set the For the portnumber
while Installation of DotProject I have give the Username dp_user
password btc123


Do i need to make these values
in confg.inc.php?
please Suggest
many thanks

atheistrical
10-26-2009, 04:50 PM
What Shuold i Set the For the portnumber
while Installation of DotProject I have give the Username dp_user
password btc123

Well, simply make the following amendments!!

You need not worry about the port number if the default port of the MySQL server is used (which normally is the case).


define("HOST","localhost");
define("USER","dp_user");
define("PASSWORD","btc123");
//define("DATABASE","test");
//Specify the database name and remove the double forward slashes above

oracleguy
10-26-2009, 05:06 PM
Is this a server you manage? If it was working and you didn't change anything and suddenly it isn't working, then are you sure MySQL is still running? Perhaps it was shut off or crashed for some reason?

Coyote6
10-26-2009, 11:26 PM
And if this is a server you manage, I would highly recommend setting a root password, and creating a user just for the current database and not use root in your web application.

mzameeruddin
10-27-2009, 07:31 AM
Well, simply make the following amendments!!

You need not worry about the port number if the default port of the MySQL server is used (which normally is the case).


define("HOST","localhost");
define("USER","dp_user");
define("PASSWORD","btc123");
//define("DATABASE","test");
//Specify the database name and remove the double forward slashes above


Hi many thanks for the Response atheistrical
in Which File do i need to make these Settings Done
is it in confg.inc.php located in c:\wamp\apps\phomyadmin3.2.0.1
please Kindly mention
many many thanks
Zam

mzameeruddin
10-31-2009, 07:46 AM
Well, simply make the following amendments!!

You need not worry about the port number if the default port of the MySQL server is used (which normally is the case).


define("HOST","localhost");
define("USER","dp_user");
define("PASSWORD","btc123");
//define("DATABASE","test");
//Specify the database name and remove the double forward slashes above



Hi many thanks

please mention in which file these information to be updated?
i updated the confg.inc.php located in c:\wamp\apps\phomyadmin3.2.0.1,

Greatly thankful for ur Response

thanks

Zam