Bug #4781 ERROR 2013: Lost connection to MySQL server during query
Submitted: 28 Jul 2004 6:45 Modified: 4 Aug 2004 17:02
Reporter: Fernando Hernandez Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:mysql-server-4.0.20 OS:Linux (Red Hat Linux ES 3)
Assigned to: Matthew Lord CPU Architecture:Any

[28 Jul 2004 6:45] Fernando Hernandez
Description:
Installed stable releases of server version 4.0.20 from sources, also tried the rpm's and even the 3.23 versions and I always get the same error:

Critical : "ERROR 2013: Lost connection to MySQL server during query"

This happens when I am trying to connect to the server from a remote host via NAVCAT or mysqlcc, but it works just fine from the localhost.  I have been unable to find an answer to this anywhere.  There were nevere errors about missing dependencies or anything, what I am missing? or not doing?  I have a very slim my.cnf file following:

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
set-variable = max_connect_errors=5000
     
[mysql.server]
user=mysql
basedir=/var/lib

[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

And the connection log says...that is after quite a few times of starting and stopping...

040707 21:44:29  mysqld started
/usr/sbin/mysqld: ready for connections
040707 22:00:41  /usr/sbin/mysqld: Normal shutdown

040707 22:00:41  /usr/sbin/mysqld: Shutdown Complete

040707 22:00:41  mysqld ended

040707 22:12:14  mysqld started
/usr/sbin/mysqld: ready for connections
040707 22:35:43  /usr/sbin/mysqld: Normal shutdown

040707 22:35:43  /usr/sbin/mysqld: Shutdown Complete

040707 22:35:43  mysqld ended

040719 23:06:16  mysqld started
/usr/sbin/mysqld: ready for connections
040719 23:17:42  /usr/sbin/mysqld: Normal shutdown

040719 23:17:42  /usr/sbin/mysqld: Shutdown Complete

040719 23:17:42  mysqld ended

040727 22:51:33  mysqld started
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
040727 22:51:33  InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
040727 22:51:34  InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
040727 22:51:34  InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
040727 22:51:35  InnoDB: Started
/usr/sbin/mysqld: ready for connections.
Version: '4.0.20-standard'  socket: '/var/lib/mysql/mysql.sock'  port: 3306
040727 23:13:24  /usr/sbin/mysqld: Normal shutdown

040727 23:13:24  InnoDB: Starting shutdown...
040727 23:13:27  InnoDB: Shutdown completed
040727 23:13:27  /usr/sbin/mysqld: Shutdown Complete

040727 23:13:27  mysqld ended

040727 23:13:42  mysqld started
040727 23:13:42  InnoDB: Started
/usr/sbin/mysqld: ready for connections.
Version: '4.0.20-standard'  socket: '/var/lib/mysql/mysql.sock'  port: 3306

Suggestions? 

How to repeat:
Just install the rpm packages from the download area onto a RH ES 3 system.
[28 Jul 2004 20:54] Matthew Lord
Dear Sir,

I am unable to repeat this problem.  Are you sure that you have the write user accounts?  
Remember that login accounts in mysql are a combination of user and host.

Best Regards
[29 Jul 2004 3:15] Fernando Hernandez
OK, issue is still there...

This is the command issued to make sure the port is open:

[root@attcbackup root]# nmap -sT -O localhost

Starting nmap V. 3.00 ( www.insecure.org/nmap/ )
Interesting ports on attcbackup.caasdphb.brown.edu (127.0.0.1):
(The 1590 ports scanned but not shown below are in state: closed)
Port       State       Service
22/tcp     open        ssh                     
25/tcp     open        smtp                    
80/tcp     open        http                    
111/tcp    open        sunrpc                  
139/tcp    open        netbios-ssn             
443/tcp    open        https                   
445/tcp    open        microsoft-ds            
631/tcp    open        ipp                     
3306/tcp   open        mysql                   
6000/tcp   open        X11                     
10000/tcp  open        snet-sensor-mgmt        
Remote operating system guess: Linux Kernel 2.4.0 - 2.5.20
Uptime 0.925 days (since Tue Jul 27 21:56:33 2004)

Nmap run completed -- 1 IP address (1 host up) scanned in 5 seconds

Login onto the system localy works, with the root username and password:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6 to server version: 4.0.20-standard

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> 

But when I try from yet another Linux system on the network I get the following:

ERROR 2003: Can't connect to MySQL server on 'attcbackup.caasdphb.brown.edu' (113)

AND STILL CANNOT CONNECT>>>
[29 Jul 2004 3:23] Fernando Hernandez
Ohh, one more item,

Here's the output from "netstat -ap"

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name   
tcp        0      0 *:20000                 *:*                     LISTEN      2229/perl           
tcp        0      0 *:32768                 *:*                     LISTEN      1911/rpc.statd      
tcp        0      0 attcbackup.caasdp:32769 *:*                     LISTEN      2059/xinetd         
tcp        0      0 *:mysql                 *:*                     LISTEN      19279/mysqld        
tcp        0      0 *:netbios-ssn           *:*                     LISTEN      2163/smbd           
tcp        0      0 *:sunrpc                *:*                     LISTEN      1892/portmap        
tcp        0      0 *:x11                   *:*                     LISTEN      2300/X              
tcp        0      0 *:10000                 *:*                     LISTEN      2236/perl           
tcp        0      0 *:http                  *:*                     LISTEN      2114/httpd          
tcp        0      0 *:ssh                   *:*                     LISTEN      2045/sshd           
tcp        0      0 attcbackup.caasdphb:ipp *:*                     LISTEN      2005/cupsd          
tcp        0      0 attcbackup.caasdph:smtp *:*                     LISTEN      2085/sendmail: acce 
tcp        0      0 attcback:x11-ssh-offset *:*                     LISTEN      19839/0             
tcp        0      0 *:https                 *:*                     LISTEN      2114/httpd          
tcp        0      0 *:microsoft-ds          *:*                     LISTEN      2163/smbd           
tcp        0     80 attcbackup.caasdphb:ssh 64.17.248.114:32777     ESTABLISHED 19839/0             
udp        0      0 *:32768                 *:*                                 1911/rpc.statd      
udp        0      0 attcbackup.c:netbios-ns *:*                                 2167/nmbd           
udp        0      0 *:netbios-ns            *:*                                 2167/nmbd           
udp        0      0 attcbackup.:netbios-dgm *:*                                 2167/nmbd           
udp        0      0 *:netbios-dgm           *:*                                 2167/nmbd           
udp        0      0 *:10000                 *:*                                 2236/perl           
udp        0      0 *:815                   *:*                                 1911/rpc.statd      
udp        0      0 *:sunrpc                *:*                                 1892/portmap        
udp        0      0 *:ipp                   *:*                                 2005/cupsd          

Thank You....
Fernando
[29 Jul 2004 3:36] Matthew Lord
Hi Fernando,

I'm still not sure that this is not a mysql account issue.  Do you see the necessary account to 
connect from the remote machine when you do select user,host from mysql.user;?

Best Regards
[4 Aug 2004 5:22] Fernando Hernandez
I am going nuts with this issue, 

I typed in from the command line within the mysql server :

mysql -h attcbackup.caasdphb.brown.edu --user=root --password=passwd

AND I GOT:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8 to server version: 4.0.20-standard

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> 

So, I suppose the single fact that I got that far means that ports are open, the user exists and is working fine (from the local system), and that supposedly remote connections should work.  I also opened "mysqlcc" and tried adding users that way and still...nothing.  I am not a MySQL admin, I need to be walked through this one, I just got thrown into this thing because there is "no one else"....   I have MySQL installed on SuSE 9.1 Pro and it works great without all the errors, this is ofcourse SuSE built but still it is version 18 or something and this one is VER 20 and it does NOT work.  I'm done through with RH ES 3...If you need temporary access to the system let me know I am at the end of the line.  I want to buy the RedHat "supported" MySQL packages but if those do not work either and the company spends money on it I will not hear the end of it................

I've done "rpcinfo" "nmap" "chkconfig" installed all kinds of MySQL versions 17,18,20

Help is appreciated....
[4 Aug 2004 17:02] Matthew Lord
Hi Fernando,

And can you execute any of the queries which cause the error using the text client once you've 
logged in?  I assume this is on x86 hardware?

I would encourage you to take advantage of the community based support we have as well:
lists.mysql.com
mysql.com/IRC

They are very active and it's not unusual to get help from mysql employees.
Through this channel, however, we need a repeatable test case in order to proceed.

Best Regards