Lost connection to MySQL server at 'reading initial communication packet'

Status
Not open for further replies.

dhennen

New Member
Messages
18
Reaction score
0
Points
1
Hi,
I've searched the forum for this and found this question asked before but never seen it with any replies. I hope I fare better:

I have a MySQL database on my account (upy844.x10hosting.com/MagIndex), and some PHP programs that try to access it. Unfortunately, when they try to connect it doesn't work.

This line of code:
$conn = mysql_connect("Localhost", "jomocha", "-censored-") or die(mysql_error());

produces this error:
Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server at 'reading initial communication packet', system error: 111 in /home/shaggy/public_html/MagIndex/ArtFind.php on line 6
Lost connection to MySQL server at 'reading initial communication packet', system error: 111

Thanks,
Don
 

Anna

I am just me
Staff member
Messages
11,756
Reaction score
583
Points
113
first, try using all lowercase for the host: localhost

secondly, to note that databases, as well as databases users, automatically gets prefixed with your cPanel username, like: cpanelname_databasename and cpanelname_databaseuser, given that jomocha is not correct username in your code.
 

dhennen

New Member
Messages
18
Reaction score
0
Points
1
Thanks, Anna! You hit the nail right on the head. This is my first time putting a database on this host and I wasn't clear just how things fit together, but with your answer, things are up and running.

I also like the dancing hamster on your avatar. :)
 

Anna

I am just me
Staff member
Messages
11,756
Reaction score
583
Points
113
:) yeah, it is a nice avatar, thanks.

glad to hear it works now, I'll close this thread then to mark as resolved.
 
Status
Not open for further replies.
Top