Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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'm trying to set up my server to accept remote connections to MySQL. It now works using this command within ssh : mysql -u testuser -h -p but when i try to do a mysqli connect using php, I get an error message:

Can't connect to MySQL server on

If I use mysql connect, I get Lost connection to MySQL server during query

If I telnet to my ip address on port 3306, I get the following:

Got packets out of order, connection to host lost

I thought this would be straight forward and it easy to get it connecting through ssh. I can connect fine using HeidiSql program also. I have Plesk installed on the IP address so maybe this is interfering but I wouldn't imagine so.

Anyone got any ideas as to what could be wrong?

share|improve this question
Which distro are you running? Please post the entire error message (include error code)? – quanta Aug 23 '11 at 14:43

If you do sudo netstat -lntp | grep 3306, what is the process that comes up(at the end)? Is it mysqld, or is it some Plesk process? If it is some Plesk process, then you will need to figure out how to either load all your tables into Plesk's MySQL instance, or figure out how to stop Plesk's MySQL and load all of its data into your instance of MySQL. mysqldump will be your friend here.

What are your iptables filters like? If you can, then try iptables -I INPUT -p tcp --dport 3306 -d -s your.originating.ip.address -j ACCEPT. This will allow traffic from your IP address to the host via the destination IP address on the port that MySQL uses.

share|improve this answer

In /etc/my.cnf, make sure that "skip-networking" is NOT commented out.

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.