OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
mysql socket vanishes after each system halt/(re)boot

From: mufurcz (mufurcziinet.net.au)
Date: Tue Apr 01 2008 - 08:14:25 CDT


Hi,

After every system boot I am loosing the mysql server directory from /var/run,
ergo the socket file from /var/run/mysql.

After every boot I have to kill manually the mysql processes and restart the server
process manually.

It looks like (from the error log below) that mysqld_safe (when starts from rc.conf.local)
won't/can't start the server because one is already running.

Is this a mysql bug or I am doing something silly?

The suggested (http://dev.mysql.com/doc/refman/5.0/en/operating-system-error-codes.html)
is useless.

Mufurcz

------------------------------------------------------------------

Last login: Mon Mar 31 07:39:30 2008 from 192.168.1.123
OpenBSD 4.2 (GENERIC) #375: Tue Aug 28 10:38:44 MDT 2007
Welcome to OpenBSD: The proactively secure Unix-like operating system.
Please use the sendbug(1) utility to report bugs in the system.....

Terminal type? [vt100]

# ps -aux | grep mysqld
root 10008 0.0 0.1 644 536 C0- I 7:25AM 0:00.01 /bin/sh /usr/local/bin/mysqld_safe
_mysql 11507 0.0 3.2 40396 16944 C0- S 7:25AM 0:00.44 /usr/local/libexec/mysqld --basedir

# mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)

# cd /var/run/mysql
ksh: cd: /var/run/mysql - No such file or directory

>>>>> The entry in rc.conf.local:

#
# mysql
#
if [ -x /usr/local/bin/mysqld_safe ]; then
         echo -n ' MySQL'
         /usr/local/bin/mysqld_safe >/dev/null 2>&1 &
fi

# netstat -an | grep 3306
tcp 0 0 127.0.0.1.3306 *.* LISTEN

# /usr/local/bin/mysqladmin -u root -p shutdown
Enter password:
/usr/local/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysql/mysql.sock' exists!

# kill -9 10008 11507

# /usr/local/bin/mysqld_safe &
[1] 24585
# Starting mysqld daemon with databases from /var/mysql <Enter>

# ls -la /var/run/mysql
total 8
drwx--x--x 2 _mysql _mysql 512 Apr 2 08:30 .
drwxr-xr-x 3 root wheel 512 Apr 2 08:30 ..
srwxrwxrwx 1 _mysql _mysql 0 Apr 2 08:30 mysql.sock

# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.45-log OpenBSD port: mysql-server-5.0.45

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

mysql> use mail
Database changed

# /usr/local/bin/mysqladmin -u root -p shutdown
Enter password:
STOPPING server from pid file /var/mysql/vega.transylvania.org.au.pid
080402 08:40:22 mysqld ended

# ls -la /var/run/mysql
total 8
drwx--x--x 2 _mysql _mysql 512 Apr 2 08:40 .
drwxr-xr-x 3 root wheel 512 Apr 2 08:30 ..

>>>>> snippets from the /var/mysql

............
............
............
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
080402 7:27:11 InnoDB: Unable to open the first data file
InnoDB: Error in opening ./ibdata1
080402 7:27:11 InnoDB: Operating system error number 35 in a file operation.
InnoDB: Error number 35 means 'Resource temporarily unavailable'.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.0/en/operating-system-error-codes.html
InnoDB: Could not open or create data files.
InnoDB: If you tried to add new data files, and it failed here,
InnoDB: you should now edit innodb_data_file_path in my.cnf back
InnoDB: to what it was, and remove the new ibdata files InnoDB created
InnoDB: in this failed attempt. InnoDB only wrote those files full of
InnoDB: zeros, but did not yet use them in any way. But be careful: do not
InnoDB: remove old data files which contain your precious data!
080402 7:27:11 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use
080402 7:27:11 [ERROR] Do you already have another mysqld server running on port: 3306 ?
080402 7:27:11 [ERROR] Aborting

080402 7:27:11 [Note] /usr/local/libexec/mysqld: Shutdown complete

080402 07:27:11 mysqld ended

080402 08:30:06 mysqld started
080402 8:30:06 InnoDB: Started; log sequence number 0 43655
080402 8:30:06 [Note] /usr/local/libexec/mysqld: ready for connections.
Version: '5.0.45-log' socket: '/var/run/mysql/mysql.sock' port: 3306 OpenBSD port: mysql-server-5.0
.45
080402 8:40:20 [Note] /usr/local/libexec/mysqld: Normal shutdown

080402 8:40:20 InnoDB: Starting shutdown...
080402 8:40:22 InnoDB: Shutdown completed; log sequence number 0 43655
080402 8:40:22 [Note] /usr/local/libexec/mysqld: Shutdown complete

080402 08:40:22 mysqld ended