Matt Matt - 3 years ago 314
MySQL Question

Lost connection to MySQL server at 'reading initial communication packet', system error: 113

I have two Debian boxes:


  1. used apt-get to install mysql-server mysql-client phpmyadmin

  2. used apt-get to install apache2 apache2-mod-php5



I'm trying to connect to the MySQL server using the Apache box but I get this error from PHP:


Lost connection to MySQL server at 'reading initial communication packet', system error: 113


I can connect up to MySQL fine using a Windows-based client on the same network. This makes me wonder about how the Apache2/PHP is setup.

Additional reading about error 113 makes me wonder about hostnames and such. my.cnf on MySQL box is set to bind-address = 192.168.1.202, and PHP is trying to connect to 192.168.1.202.

Any and all help greatly appreciated! I'm not an evil genius by a long shot and this is my first time trying to use solely aptitude to set this up. I bet it's something silly I forgot.

Answer Source

I'm using Ubuntu 11.04

I logged in as root and ran

cd /etc/mysql
nano my.cnf

Then I found bind-address = 127.0.0.1 and added a # before it so it's looks like #bind-address = 127.0.0.1

Than I ran /etc/init.d/mysql restart to restart MySQL. Then it started working.

Hope this helps. I know Debian and Ubuntu are about the same when doing stuff.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download