Bug #8513 Server will not start if /var/run/mysqld does not exist

Submitted: 15 Feb 2005 4:32 Modified: 12 Mar 2005 4:40
Reporter: Kimberly Kulak Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.9-Debian_4-log OS:Linux (Linux)
Assigned to: Jim Winstead CPU Architecture:Any

[15 Feb 2005 4:32] Kimberly Kulak
Description:
I am experimenting with using a tmpfs mounted on /var/run. An effect of this is that the directory /var/run/mysqld does not exist on system boot. And if /ver/run/mysqld does not exists the server will not start. These error messages are put into the system log:

Feb 14 19:21:29 pegasus mysqld_safe[2390]: started
Feb 14 19:21:30 pegasus mysqld[2393]: 050214 19:21:30 [ERROR] Can't start server : Bind on unix socket: No such file or directory
Feb 14 19:21:30 pegasus mysqld[2393]: 050214 19:21:30 [ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld.sock ?
Feb 14 19:21:30 pegasus mysqld[2393]: 050214 19:21:30 [ERROR] Aborting
Feb 14 19:21:30 pegasus mysqld[2393]:
Feb 14 19:21:30 pegasus mysqld[2393]: 050214 19:21:30 [Note] /usr/sbin/mysqld: Shutdown complete

How to repeat:
Very easy to recreate:
1. Stop the server, if it is running.
2. rmdir /var/run/mysqld
3. Start the server. I use "/etc/init.d/mysql start"

Suggested fix:
I've put a quick fix into mysqld_safe to create /var/run/mysqld if it doesn't exist. Since I'm quite new to MySQL you'll probably have a better way.

*** /usr/bin/mysqld_safe.0      2005-02-14 19:24:29.000000000 -0800
--- /usr/bin/mysqld_safe        2005-02-14 19:40:46.000000000 -0800
***************
*** 149,154 ****
--- 149,163 ----
  parse_arguments PICK-ARGS-FROM-ARGV "$@"
  safe_mysql_unix_port=${mysql_unix_port:-${MYSQL_UNIX_PORT:-/var/run/mysqld/mysqld.sock}}

+ # Create directory the $mysql_unix_port is in.
+ unix_port_dir=`dirname $safe_mysql_unix_port`
+ if [ ! -d $unix_port_dir ]
+ then
+   mkdir $unix_port_dir
+   chmod 775 $unix_port_dir
+   chown "${user}.${user}" $unix_port_dir
+ fi
+
  if test ! -x $ledir/$MYSQLD
  then
    echo "The file $ledir/$MYSQLD doesn't exist or is not executable"
[15 Feb 2005 11:53] Aleksey Kishkin
It's a rather 'feature request', not a bug.
[12 Mar 2005 0:04] Jim Winstead
Pushed, will be in 4.1.11 and 5.0.3.
[12 Mar 2005 4:40] Paul DuBois
Noted in 4.1.11, 5.0.3 changelogs.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.