Bug #5065 ERROR 2013: Lost connection to MySQL server during query
Submitted: 16 Aug 2004 16:57 Modified: 18 Aug 2004 18:02
Reporter: Florian Effenberger Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Installing Severity:S1 (Critical)
Version:4.0.20 OS:Linux (Linux)
Assigned to: Matthew Lord CPU Architecture:Any

[16 Aug 2004 16:57] Florian Effenberger
Description:
I installed MySQL 4.0.20 myself with the following steps:

apt-get install libncurses5-dev

groupadd mysql

useradd -g mysql mysql

CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-raid --with-libwrap --without-debug --with-embedded-server --with-mysqlfs --with-vio --with-openssl

make

make install

cp support-files/my-medium.cnf /etc/my.cnf

/usr/local/mysql/bin/mysql_install_db

chown -R root  /usr/local/mysql

chown -R mysql /usr/local/mysql/var

chgrp -R mysql /usr/local/mysql

ln -s /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql

update-rc.d mysql defaults

/etc/init.d/mysql start

Then I changed my root users password according to the instructions printed by the installer. The change worked fine.

Now, when I try to logon with the root password or any other password on the same machine the SQL server is running (no firewalls installed at the moment) using

/usr/local/mysql/bin/mysql -u root -p

it works the very first time. All subsequent tries I get

ERROR 2013: Lost connection to MySQL server during query

It works for one time as soon as I restart the MySQL server. When no password is entered (just Enter pressed) at the prompt, I get a normal Access denied error. I checked my /etc/hosts, disabled the second network interface, recompiled and fully reinstalled MySQL, checked for old libraries, checked my hosts.allow and hosts.deny, but nothing helped.

The above configuration worked just fine with Debian 3.0, so I guess its a problem with newer Debian 3.1 software? I run the as-of-today current release of Debian 3.1 (Sarge) with Kernel 2.6.7-1-386. gcc is version 3.3.4.

What could it be? What log files and what debug information do you need?

How to repeat:
See above.
[16 Aug 2004 18:30] Florian Effenberger
>Description:
        <precise description of the problem (multiple lines)>
>How-To-Repeat:
        <code/input/activities to reproduce the problem (multiple lines)>
>Fix:
        <how to correct or work around the problem, if known (multiple lines)>

>Submitter-Id:  <submitter ID>
>Originator:    root
>Organization:
 <organization of PR author (multiple lines)>
>MySQL support: [none | licence | email support | extended email support ]
>Synopsis:      <synopsis of the problem (one line)>
>Severity:      <[ non-critical | serious | critical ] (one line)>
>Priority:      <[ low | medium | high ] (one line)>
>Category:      mysql
>Class:         <[ sw-bug | doc-bug | change-request | support ] (one line)>
>Release:       mysql-4.0.20 (Source distribution)

>C compiler:    gcc (GCC) 3.3.4 (Debian 1:3.3.4-6sarge1)
>C++ compiler:  gcc (GCC) 3.3.4 (Debian 1:3.3.4-6sarge1)
>Environment:
        <machine, os, target, libraries (multiple lines)>
System: Linux grisu 2.6.7-1-386 #1 Thu Jul 8 05:08:04 EDT 2004 i586 GNU/Linux
Architecture: i586

Some paths:  /usr/bin/perl /usr/bin/make /usr/bin/gcc /usr/bin/cc
GCC: Lese Spezifikationen von /usr/lib/gcc-lib/i486-linux/3.3.4/specs
Konfiguriert mit: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-debug --enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i486-linux
Thread-Modell: posix
gcc-Version 3.3.4 (Debian 1:3.3.4-6sarge1)
Compilation info: CC='gcc'  CFLAGS='-O3'  CXX='gcc'  CXXFLAGS='-O3 -felide-constructors -fno-exceptions -fno-rtti'  LDFLAGS=''  ASFLAGS=''
LIBC:
lrwxrwxrwx  1 root root 13 2004-08-14 09:18 /lib/libc.so.6 -> libc-2.3.2.so
-rw-r--r--  1 root root 1243856 2004-05-25 20:40 /lib/libc-2.3.2.so
-rw-r--r--  1 root root 2640410 2004-05-25 20:40 /usr/lib/libc.a
-rw-r--r--  1 root root 204 2004-05-25 20:16 /usr/lib/libc.so
Configure command: ./configure '--prefix=/usr/local/mysql' '--enable-assembler' '--with-raid' '--with-libwrap' '--without-debug' '--with-embedded-server' '--with-mysqlfs' '--with-vio' '--with-openssl' 'CFLAGS=-O3' 'CXXFLAGS=-O3 -felide-constructors -fno-exceptions -fno-rtti' 'CXX=gcc'
[16 Aug 2004 20:11] Florian Effenberger
I just tried it with the same system, but not using my customized compile settings, but the original ones from the MySQL documentatio. Then it seems to work fine.

However, I still consider this a bug. Using my customized compile settings it worked just fine with Debian 3.0.

Please let me know if there is anything else you need to know! ;-)
[17 Aug 2004 2:23] Matthew Lord
Hi Florian,

Would it be possible for you to try the build on your system w/o the --with-raid and --with-
mysqlfs options?  Neither one of those options should be used in a production environment.  The 
raid option was our dropped software raid for myisam tables and the mysqlfs was an old proof
of concept that was also dropped.

I don't have a similar machine available so it is why I ask.  Those two are the most likely culprits 
so I'd like to eliminate those first.

Best Regards
[17 Aug 2004 12:18] Florian Effenberger
No, I have the same problem again. I'll try to leave out other parameters as well, hoping that I'll find the culprit. :)

Unfortunately, this is an internal system I can't give you access to, it isn't even connected to the Internet. But if there is any information I can provide you with in order to help you fix this problem, please let me know. The same configuration worked just fine on Debian 3.0 with the "old" 2.95 gcc.
[17 Aug 2004 12:21] Florian Effenberger
No, I have the same problem again. I'll try to leave out other parameters as well, hoping that I'll find the culprit. :)

Unfortunately, this is an internal system I can't give you access to, it isn't even connected to the Internet. But if there is any information I can provide you with in order to help you fix this problem, please let me know. The same configuration worked just fine on Debian 3.0 with the "old" 2.95 gcc.
[18 Aug 2004 6:30] Florian Effenberger
It seems I have found the culprit. It is not my configure command, but a slight modification I've been doing for months in the sql/sql_parse.cc file.

Old line: end=strnmov(buff,server_version,SERVER_VERSION_LENGTH)+1;
New line: end=strnmov(buff,"",0)+1;

I omit the version number with this small change. It has been working for more than a year without any problems, but now on 3.1, it doesn't anymore. Maybe it's the new gcc?

I even tried commenting out with /* end=strnmov(buff,server_version,SERVER_VERSION_LENGTH)+1; */ , but this causes an error as well.

Do you have an idea on how to change the above line to remove the version number but have MySQL still work?
[18 Aug 2004 6:56] Florian Effenberger
I tried

end=strnmov(buff,"",SERVER_VERSION_LENGTH)+1;

and it seems to work. However, please let me know if there is any better setting for leaving out the version number. Thanks!
[18 Aug 2004 18:02] Matthew Lord
Hi,

OK, this was probably an optimization that gcc was doing that was causing problems.  Your 
solution is fine.

Best Regards!
[30 Jun 2008 6:57] Sourav Sharma
i' v einstalled my sql 5 on windows xp plateform but it' ll display an error no 2013 when is configure that database server plz provide me solution
[30 Jun 2008 6:58] Sourav Sharma
i' v installed my sql 5 on windows xp plateform but it' ll display an error no 2013 when is configure that database server plz provide me solution