Bug #14168 mysql deamon start, but then stops
Submitted: 20 Oct 2005 9:09 Modified: 20 Oct 2005 15:29
Reporter: Willy van Duiven Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1.14 OS:Linux (linux mandrake 10.1)
Assigned to: CPU Architecture:Any

[20 Oct 2005 9:09] Willy van Duiven
Description:
after installation according to the binaire installation file. I want to start the deamon.
it says it starts but that it stops directly:

[root@server mysql]# ls
bin/        data/              include/        man/         scripts/    support-files/
configure*  docs/              INSTALL-BINARY  mysql-test/  share/      tests/
COPYING     EXCEPTIONS-CLIENT  lib/            README       sql-bench/
[root@server mysql]# bin/mysqld_safe --user=mysql &
[1] 20997
[root@server mysql]# Starting mysqld daemon with databases from /usr/local/mysql/data
STOPPING server from pid file /usr/local/mysql/data/server.kula.nl.pid
051020 10:50:22  mysqld ended

How to repeat:
[root@server mysql]# ls
bin/        data/              include/        man/         scripts/    support-files/
configure*  docs/              INSTALL-BINARY  mysql-test/  share/      tests/
COPYING     EXCEPTIONS-CLIENT  lib/            README       sql-bench/
[root@server mysql]# bin/mysqld_safe --user=mysql &
[1] 20997
[root@server mysql]# Starting mysqld daemon with databases from /usr/local/mysql/data
STOPPING server from pid file /usr/local/mysql/data/server.kula.nl.pid
051020 10:50:22  mysqld ended
[20 Oct 2005 9:10] Willy van Duiven
bin/mysqld --user=mysql &
[2] 21571
[1]   Done                    bin/mysqld_safe --user=mysql
[root@server mysql]# 051020 11:01:11 [ERROR] Can't start server: Bind on TCP/IP port: Add                          ress already in use
051020 11:01:11 [ERROR] Do you already have another mysqld server running on port: 3306 ?
051020 11:01:11 [ERROR] Aborting

051020 11:01:11 [Note] bin/mysqld: Shutdown complete

[root@server mysql]#
[20 Oct 2005 9:22] Valeriy Kravchuk
Thank you for a problem report. It looks like you may have some other version of mysqld listening to the default 3306 port. It may be mysql package from the Mandrake default installation etc.

Please, send the results of netstat -a command obtained before trying to start your new mysqld. Please, try also to start with explicitely mentioned non-default port, like this:

mysql_safe --port=3307 &

It should start normally, if my idea is right.
[20 Oct 2005 9:23] Willy van Duiven
I found this file:  /data/server.kula.nl.err

051019 16:15:27  mysqld started
 /usr/local/mysql/bin/mysqld: Can't read dir of '/root/tmp/' (Errcode: 13)
 /usr/local/mysql/bin/mysqld: Can't create/write to file '/root/tmp/ibPAlgAN' (Errcode: 13)
mysqld got signal 11;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

key_buffer_size=0
read_buffer_size=131072
max_used_connections=0
max_connections=100
threads_connected=0
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 217599 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd=(nil)
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
Cannot determine thread, fp=0xbfffcb18, backtrace may not be correct.
Stack range sanity check OK, backtrace follows:
0x811f9bc
0x40052c32
0x40050aa8
0x4004d5e0
0x8307e9b
0x819c8b6
0x82cf0aa
0x81e00fb
0x819cef7
0x8195a69
0x8122720
0x812007e
0x4011231b
0x80c4281
New value of fp=(nil) failed sanity check, terminating stack trace!
Please read http://dev.mysql.com/doc/mysql/en/Using_stack_trace.html and follow instructions on how to resolve the stack trace. Resolved
stack trace is much more helpful in diagnosing the problem, so please do 
resolve it
The manual page at http://www.mysql.com/doc/en/Crashing.html contains
information that should help you find out what is causing the crash.
051019 16:15:28  mysqld ended
[20 Oct 2005 9:40] Willy van Duiven
result of using the --port=3307 option:

[root@server mysql]# bin/mysqld_safe --user=mysql & --port=3307 &
[1] 23217
[2] 23218
[root@server mysql]# bash: --port=3307: command not found
Starting mysqld daemon with databases from /usr/local/mysql/data
STOPPING server from pid file /usr/local/mysql/data/server.kula.nl.pid
051020 11:36:29  mysqld ended

bin/mysqld_safe --port=3307 &
[3] 23260
[1]   Done                    bin/mysqld_safe --user=mysql
[2]   Exit 127                --port=3307
[root@server mysql]# Starting mysqld daemon with databases from /usr/local/mysql/data
STOPPING server from pid file /usr/local/mysql/data/server.kula.nl.pid
051020 11:36:46  mysqld ended
[20 Oct 2005 10:37] Valeriy Kravchuk
Have you seen that:

tcp        0      0 *:mysql                 *:*                     LISTEN

in netstat -a results? That is what I had written about (mysql can be found in /etc/services, just look) - another MySQL server already runs. You should also find the processes using:

ps -ef | grep mysqld

As for my recommendation, your command line is wrong. Use that one instead:

bin/mysqld_safe --user=mysql --port=3307 &

That crash in your log looks bad. So, please, find mysqld processed already running, kill -9 them all and try to start the server once more. Inform about the results.

Have you performed mysql_install_db, by the way?
[20 Oct 2005 11:02] Willy van Duiven
kill -9 all the mysqld processes
did bin/mysqld_safe --user=mysql --port=3307 &
same result server "stopped"
came acros many other bugs like this on this bug list. maybe it has sometrhing to do with the permission right?
http://bugs.mysql.com/bug.php?id=2029
[20 Oct 2005 11:20] Valeriy Kravchuk
OK. Please, describe all the steps you performed to install MySQL, as in the bug report you found.

Please, send also the part of the error log for the last mysqld_safe attempt you performed.
[20 Oct 2005 12:45] Willy van Duiven
I did something new:
bin/mysqld_safe --user=root &
mysql started
so ther must be a problem with permissions, I found this in server.kula.nl.err file:

51019 16:15:27  mysqld started
^G/usr/local/mysql/bin/mysqld: Can't read dir of '/root/tmp/' (Errcode: 13)
^G/usr/local/mysql/bin/mysqld: Can't create/write to file '/root/tmp/ibPAlgAN' (Errcode: 13)
mysqld got signal 11;

user mysql has no permissions for /root/tmp/
Why does mysql use this directory? how/were can I change this. The problem will besolved then?
[20 Oct 2005 14:04] Valeriy Kravchuk
Using /root/tmp is something new for me. Looks like mysqld wants to create socket in that directory, instead of normal /tmp or other you explicitely defined. (That is why I asked you to describe all the steps|commands used to install MySQL... No answer yet)

So, please, send also the results of the following commands:

df -k
env
ls -l /
ls -l /root
[20 Oct 2005 14:16] Willy van Duiven
for now this problem is solved

in my.cnf I uncomented:
# Point the following paths to different dedicated disks
tmpdir		= /tmp/		
#log-update 	= /path-to-dedicated-directory/hostname

now it runs
[20 Oct 2005 14:20] Willy van Duiven
[root@server mysql]# bin/mysqladmin version
bin/mysqladmin  Ver 8.41 Distrib 4.1.14, for pc-linux-gnu on i686
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Server version          4.1.14-standard-log
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /tmp/mysql.sock
Uptime:                 29 sec

Threads: 1  Questions: 1  Slow queries: 0  Opens: 11  Flush tables: 1  Open tables: 0  Queries per second avg: 0.034
[root@server mysql]# bin/mysqladmin version
bin/mysqladmin  Ver 8.41 Distrib 4.1.14, for pc-linux-gnu on i686
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Server version          4.1.14-standard-log
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /tmp/mysql.sock
Uptime:                 47 sec

Threads: 1  Questions: 2  Slow queries: 0  Opens: 11  Flush tables: 1  Open tables: 0  Queries per second avg: 0.043
[root@server mysql]# df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/hda1              5392052   1191732   3926416  24% /
/dev/hda6              3367972     98628   3269344   3% /home
/dev/hdc                711660    711660         0 100% /mnt/cdrom
[root@server mysql]# env
LC_PAPER=nl_NL
LESSKEY=/etc/.less
LC_ADDRESS=nl_NL
KDE_MULTIHEAD=false
HOSTNAME=server.kula.nl
LC_MONETARY=nl_NL
SHELL=/bin/bash
TERM=xterm
XDM_MANAGED=/var/run/xdmctl/xdmctl-:2,rsvd
HISTSIZE=1000
LC_SOURCED=1
TMPDIR=/root/tmp
GTK2_RC_FILES=/usr/share/themes/Galaxy/gtk-2.0/gtkrc:/etc/gtk-2.0/gtkrc:/home/willy/.gtkrc-2.0:/home/willy/.kde/share/config/gtkrc
GS_LIB=/home/willy/.fonts
GTK_RC_FILES=/usr/share/themes/Galaxy/gtk/gtkrc:/etc/gtk/gtkrc:/home/willy/.gtkrc:/home/willy/.kde/share/config/gtkrc
LC_NUMERIC=nl_NL
WINDOWID=35651591
QTDIR=/usr/lib/qt3/
KDE_FULL_SESSION=true
USER=willy
LC_TELEPHONE=nl_NL
LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:
XCURSOR_SIZE=
ENV=/root/.bashrc
USERNAME=root
SESSION_MANAGER=local/server.kula.nl:/tmp/.ICE-unix/366
KONSOLE_DCOP=DCOPRef(konsole-466,konsole)
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin
DESKTOP_SESSION=01KDE
MAIL=/var/spool/mail/willy
LC_MESSAGES=nl_NL
LC_COLLATE=nl_NL
LC_IDENTIFICATION=nl_NL
SECURE_LEVEL=4
PWD=/usr/local/mysql
INPUTRC=/etc/inputrc
KONSOLE_DCOP_SESSION=DCOPRef(konsole-466,session-1)
XMODIFIERS=@im=none
HELP_BROWSER=kfmclient openProfile webbrowsing
LANG=nl_NL
PYTHONSTARTUP=/etc/pythonrc.py
LC_MEASUREMENT=nl_NL
HISTCONTROL=ignoredups
SSH_ASKPASS=/usr/lib/ssh/gnome-ssh-askpass
HOME=/root
SHLVL=3
LANGUAGE=nl_NL:nl
GCONF_TMPDIR=/tmp
XCURSOR_THEME=default
LOGNAME=willy
LESS=-MM
TMP=/root/tmp
LC_CTYPE=nl_NL
LESSOPEN=|/usr/bin/lesspipe.sh %s
DESKTOP=kde
BROWSER=kfmclient openProfile webbrowsing
DISPLAY=:2.0
LC_TIME=nl_NL
G_BROKEN_FILENAMES=1
XAUTHORITY=/root/.xauthAouOkr
LC_NAME=nl_NL
COLORTERM=
OLDPWD=/
_=/bin/env
[root@server mysql]# ls -l /
totaal 52
drwxr-x--x    2 root adm    4096 okt 18 22:39 bin/
drwx--x---    3 root ctools 4096 okt 18 22:56 boot/
drwx--x--x   10 root root   3220 okt 20 14:35 dev/
drwx--x--x   70 root adm    4096 okt 20 15:59 etc/
drwxr-x--x    5 root adm    4096 okt 19 15:11 home/
drwxr-xr-x    2 root root   4096 okt 18 23:34 initrd/
drwxr-x--x   13 root adm    4096 okt 18 22:56 lib/
drwxr-x---    3 root adm    4096 jan  5  2004 mnt/
drwxr-xr-x    2 root root   4096 jan  5  2004 opt/
dr-xr-x---  184 root adm       0 okt 19 00:55 proc/
drwx------   16 root root   4096 okt 20 15:19 root/
drwxr-x--x    2 root adm    4096 okt 18 22:49 sbin/
drwxr-xr-x    9 root root      0 okt 19 00:55 sys/
drwxrwx-wt   14 root adm    4096 okt 20 16:14 tmp/
drwxr-x--x   12 root adm    4096 okt 18 23:03 usr/
drwxr-xr-x   20 root root   4096 okt 18 22:43 var/
[root@server mysql]# ls -l /root
totaal 12
drwx------  3 root root 4096 okt 20 14:25 Desktop/
drwx------  2 root root 4096 okt 18 23:03 drakx/
drwx------  3 root root 4096 okt 20 14:30 tmp/
[root@server mysql]#
[20 Oct 2005 15:29] Valeriy Kravchuk
Look, the environment variables:

TMP=/root/tmp
TMPDIR=/root/tmp

where pointing to the different directory than normal, default /tmp. And no other users except root had any permissions for it. That explains the results you got.

Nice to know you solved your problem. It is not a MySQL bug, in any case - just correct enviroment, configuration and permissions needed.
[14 Nov 2005 13:21] Tyler Bell
My own experience suggests that his issue (not a bug)  can be solved by setting the temp dirs correctly in /etc/sysconfig/mysql