tags:

views:

1115

answers:

4
+1  Q: 

MySQL Error 2013

I am facing connection failure to MySQL problem when I run my program for more than couple of days.MySQL Error Code is 2013 while connecting to Database. MySQL server and client programs are both on same machine. I am using FC5 as my OS and MySQL version is 5.0.18. Can anybody throw some light on this?

I am getting mysql error 2013 while calling mysql_real_connect()...

Any help is appreciated.

Thanks in Advance

k o v a

A: 
  1. Sounds like a firewall issue. Have you tried disabling the firewall temporarily?

  2. Another possible solution involves edition the startup script as mentioned here and commenting out the following line:

    SKIP=skip-networking

  3. A third possible solution is mentioned here. The user tried to access an InnoDB database and InnoDB support was accidentially deactivated for the MySQL server.

  4. (new) I found this official MySQL article which has lots of approaches to solve the problem. Did you modify the wait_timeout system variable?

VVS
1. Client and server both are on same machine. So firewall may not be a issue2. skip-networking is already disabled. Anyways, its not an issue as client and server do not communicate thru TCP/IP if both are on same machine
error is coming while calling msyql_real_connect(), so underlying database storage engine is irrelevant here.
Of course the firewall can be the source, even on the same machine. What OS are we talking about?
VVS
A: 

It could be a network error that caused the TCP/IP connection to drop, or the wait_timeout was exceeded on the server; the latter can actually be useful in keeping the # of open connections down, but the app will then need to handle errorcode 2013 correctly!!

Haim Evgi
client and server both are on same machine, so they do not communicate through TCP/IP.
How do client and server communicate, if not through TCP/IP?
VVS
A: 

Check your my.cnf. Set your bind-address to the server's IP address. Solved the issue for me. NO ONE seemed to know the answer to that one!

Dennis Day
A: 

Here's an answer you might not expect. I had encountered the same problem. MySQL Error 2013. Here are the symptoms:

  1. PHPMyAdmin fired off 2013 and error 95.

  2. I could shell into the MySQL monitor, but it took an inordinately long time to start. I could view tables and everything worked once the command line utility started

  3. The server took a LONG time to stop and restart.

  4. No errors in the MySQL error log.

I work with a good sysadmin who checked netstat -tn, which yielded the answer:

tcp 0 0 [my.srv.ip]:3306 184.73.87.215:59271 ESTABLISHED

tcp 0 1 [my.srv.ip]:38138 184.73.87.215:113 SYN_SENT

The IP resolves to Amazon Web Services. Some prick was leeching onto my 3306, even though everything but port 80 is allow-only. It's time to review my firewall rules.

There were no new tables, and mtop didn't show any activity, but I found a ton of these in the auth log:

Apr 19 15:14:52 magic2 mysqld[18953]: refused connect from ec2-184-73-87-215.compute-1.amazonaws.com

Apr 19 15:18:02 magic2 mysqld[18953]: refused connect from ec2-184-73-87-215.compute-1.amazonaws.com

After blocking the offending IP in iptables, the problem suddenly went away. Sneaky Bastards. The moral of this story is: What looks like bug, might be a hacker.

bz

Boot Zero