Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am deploying a MySQL server behind a proxy server (apache mod_proxy). I am getting this error when I try to connect using mysql client or using php to connect to mysql server.

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

I tried by setting bind-address to and commenting it, but noting worked.

I am doing some port mapping on proxy server in addition to proxying, using proxypass. eg:

ProxyPass /
ProxyPassReverse /

I have set the apache server to listen to 3306 and there is no mysql server running on proxy server.

share|improve this question
From your config it looks like your trying to talk HTTP to MySQL. Is that right? Can mod_proxy go in front of MySQL? – Coops Jun 21 '11 at 8:50
Well when it comes to remote logging to mysql-server it uses HTTP right? (Please correct me if I wrong) – gihan Jun 21 '11 at 9:07
Nope, HTTP isn't used by MySQL. If you're looking to simply proxy a mysql connection you may find this easier: – Coops Jun 21 '11 at 9:10
Oops. A BIG Thank for saving me. I thought I could do it using mod_proxy. – gihan Jun 21 '11 at 9:16

Just to make this clear, mod_proxy is for HTTP protocol only. It reads headers from HTTP protocol to work.

You should try with iptables:

iptables -t nat -A PREROUTING -p tcp --dport 3306 -j DNAT --to
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.