Jump to content

Problem with MySql Connection


rayudu

Recommended Posts

Hi Friends,

 

              i am new one to this.i have a big problem i think i will get the correct solution...

              when i am connecting to the MySql Database i am getting this.

 

Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server at 'reading initial communication packet', system error: 110 in /home/txtimg0/public_html/cherple/Scheduled_Campaigns.php  on line 24 unable to select database

 

define("prod_dbuser","xxxx");  //gtmdev1

 

define("prod_dbpass","xxxxx");  //gtmdev1

 

define("prod_database_cm2","cm2");

 

define("prod_database_glue","glue");

 

define("prod_hostname","xxxxxxxx");

 

i am defined these constants in gtm

_constants.php i am includeing this file when ever i need to connect with database.

 

this working fine in past.now we installed the new Database from then i am getting this error.

 

can any one Please me Help to Resolve this Issue.?

and why php is not connecting to the database???

 

 

Thanks,

Ramky

 

 

 

 

       

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/233186-problem-with-mysql-connection/
Share on other sites

Hi Friends,

 

              i am new one to this.i have a big problem i think i will get the correct solution...

              when i am connecting to the MySql Database i am getting this.

 

Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server at 'reading initial communication packet', system error: 110 in /home/txtimg0/public_html/cherple/Scheduled_Campaigns.php  on line 24 unable to select database

 

define("prod_dbuser","xxxx");  //gtmdev1

 

define("prod_dbpass","xxxxx");  //gtmdev1

 

define("prod_database_cm2","cm2");

 

define("prod_database_glue","glue");

 

define("prod_hostname","xxxxxxxx");

 

i am defined these constants in gtm

_constants.php i am includeing this file when ever i need to connect with database.

 

this working fine in past.now we installed the new Database from then i am getting this error.

 

can any one Please me Help to Resolve this Issue.?

and why php is not connecting to the database???

 

 

Thanks,

Ramky

 

 

 

 

       

 

 

 

That looks unfamiliar to me, try this

mysql_connect("localhost", "mysql_user", "mysql_password") or
    die("Could not connect: " . mysql_error());
mysql_select_db("cm2");

Try if this works first, I am not sure if you can connect to both databases at the same time. :/

Ted

error is not because of your php script it is because of something "wrong" with your new database install.

 

In your my.cnf file, try upping the connection timeout.

 

/etc/my.cnf or ~/.my.cnf or wherever you have it, this line:

 

connect_timeout=xx

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.