LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-20-2009, 04:24 AM   #1
manishsingh4k
LQ Newbie
 
Registered: Jul 2009
Posts: 6

Rep: Reputation: 0
Post Lost connection to MySQL server at 'reading initial communication packet', system err


Hi All,

I am connecting mysql database server through php script remotly. PHP files on other server and the database is on another. While trying to connect, i get this error message below.

Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server at 'reading initial communication packet', system error: 113

Please suggest me how to get it connected.
Thanks in advance
 
Old 07-20-2009, 05:30 AM   #2
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
Blog Entries: 1

Rep: Reputation: 261Reputation: 261Reputation: 261
Are you using iptables and does iptables allow MySQL connections?
 
Old 07-20-2009, 05:47 AM   #3
PMP
Member
 
Registered: Apr 2009
Location: ~
Distribution: RHEL, Fedora
Posts: 381

Rep: Reputation: 58
Try telnet to port of mysql defaults to 3306
 
Old 07-20-2009, 06:18 AM   #4
manishsingh4k
LQ Newbie
 
Registered: Jul 2009
Posts: 6

Original Poster
Rep: Reputation: 0
I am not using IP tables. also i tried telnet, it says "connection to host lost"

Last edited by manishsingh4k; 07-20-2009 at 06:27 AM.
 
Old 07-20-2009, 06:44 AM   #5
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Does your MySQL server listens on the IP or only on the localhost? Check my.cnf to find out.

Kind regards,

Eric
 
Old 07-20-2009, 06:53 AM   #6
PMP
Member
 
Registered: Apr 2009
Location: ~
Distribution: RHEL, Fedora
Posts: 381

Rep: Reputation: 58
Are you able to ping the server which hosts mysql
 
Old 07-20-2009, 07:08 AM   #7
manishsingh4k
LQ Newbie
 
Registered: Jul 2009
Posts: 6

Original Poster
Rep: Reputation: 0
please suggest how to view/modify the my.cnf, also how can we see the settings of IP / localhost. Yes I am able to ping the server which hosts mysql

Last edited by manishsingh4k; 07-20-2009 at 07:11 AM.
 
Old 07-20-2009, 07:14 AM   #8
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

On a default installation, depending the distro you use, the file you need to check is found in /etc/mysql and named my.cnf.

If that directory doesn't exist, look for the file using find / -name 'my.cnf' and you'll know where it is.

So 'cd' to the directory or edit using your favorite editor (vi, nano, ...).

Look for the line that says

bind-address =

If that is set to 127.0.0.1 or something else, change it to the IP of your server. The IP of your server should be known by you, or can be found using 'ifconfig' command (on Debian) or with 'ip addr sh eth0' for the first network card.

After changing the my.cnf file you need to reboot the MySQL server, normally using '/etc/init.d/mysql restart'

Kind regards,

Eric

Last edited by EricTRA; 07-20-2009 at 07:15 AM.
 
Old 07-20-2009, 07:31 AM   #9
PMP
Member
 
Registered: Apr 2009
Location: ~
Distribution: RHEL, Fedora
Posts: 381

Rep: Reputation: 58
Provide the IP of the machine from which you are making the connection.
The user from which you are making the connection

and the output of this query

Code:
select host,user,Select_priv from mysql.user;
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Lost connection to MySQL server at reading.... jonaskellens Linux - Server 9 06-18-2009 07:07 AM
Error: Lost connection to MySQL server during query the expert Linux - Newbie 6 09-04-2008 12:40 PM
Lost connection to MySQL server during query figure8car Mandriva 1 12-05-2004 04:28 PM
ERROR 2013: Lost connection to MySQL server during query kicap Linux - Software 0 11-23-2004 08:30 PM
Error: lost connection to MySQL server during query patpawlowski Programming 2 01-23-2004 07:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration