Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL server at 'reading initial communication packet', system error: 111 [closed]

Tags:

sql

php

I moved my site to godaddy server, but the SQL connection is not working even with adequate changes which was working perfectly fine before

<?php
$link = mysql_connect('www.xxxxx.com', 'phpadminusername', 'phpadminpasswor');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
/*echo 'Connected successfully';*/
echo "DB CONNECTION :<font color='green'>ACTIVE</font>";


?>

It is showing an error

Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server at 'reading initial communication packet', system error: 111 in /home/content/58/9508458/html/psychiatric/private.php on line 196 Could not connect: Lost connection to MySQL server at 'reading initial communication packet', system error: 111

like image 820
Tina Avatar asked Jun 23 '12 10:06

Tina


2 Answers

fixed by updating to hostname in account manager specifically given by godaddy.com .. not just the domain name

like image 102
Tina Avatar answered Oct 19 '22 09:10

Tina


That probably means mySQL is configured to only listed to requests from a particular hosts (or hosts). You can tell MySQL to only accept packets from particular IP addresses (usually localhost, but it may be wider on GoDaddy - not sure as I don't use them).

Check your connection string - specifically the 'www.xxxxx.com' bit. This might need to be 'localhost' or a specific IP address.

like image 39
Robbie Avatar answered Oct 19 '22 11:10

Robbie