Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
07-20-2009, 05:24 AM
|
#1
|
LQ Newbie
Registered: Jul 2009
Posts: 6
Rep:
|
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
|
|
|
07-20-2009, 06:30 AM
|
#2
|
ReliaFree Maintainer
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
|
Are you using iptables and does iptables allow MySQL connections?
|
|
|
07-20-2009, 06:47 AM
|
#3
|
Member
Registered: Apr 2009
Location: ~
Distribution: RHEL, Fedora
Posts: 381
Rep:
|
Try telnet to port of mysql defaults to 3306
|
|
|
07-20-2009, 07:18 AM
|
#4
|
LQ Newbie
Registered: Jul 2009
Posts: 6
Original Poster
Rep:
|
I am not using IP tables. also i tried telnet, it says "connection to host lost"
Last edited by manishsingh4k; 07-20-2009 at 07:27 AM.
|
|
|
07-20-2009, 07:44 AM
|
#5
|
LQ Guru
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
|
Does your MySQL server listens on the IP or only on the localhost? Check my.cnf to find out.
Kind regards,
Eric
|
|
|
07-20-2009, 07:53 AM
|
#6
|
Member
Registered: Apr 2009
Location: ~
Distribution: RHEL, Fedora
Posts: 381
Rep:
|
Are you able to ping the server which hosts mysql
|
|
|
07-20-2009, 08:08 AM
|
#7
|
LQ Newbie
Registered: Jul 2009
Posts: 6
Original Poster
Rep:
|
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 08:11 AM.
|
|
|
07-20-2009, 08:14 AM
|
#8
|
LQ Guru
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
|
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 08:15 AM.
|
|
|
07-20-2009, 08:31 AM
|
#9
|
Member
Registered: Apr 2009
Location: ~
Distribution: RHEL, Fedora
Posts: 381
Rep:
|
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;
|
|
|
All times are GMT -5. The time now is 11:37 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|