Description:
mysqld_safe deletes mysql.sock when starting.  When you have more than one instance of mysqld running on the same machine, when you start the second instance, it deletes always /var/lib/mysql.sock, because the variable
safe_mysql_unix_port
is set before parsing all the command-line arguments.
Look at the diff -p2  I´m attaching with this report. It solved the problem for me, as with the patch, the variable is correctly set when you use the
 --socket  option in the command-line.
How to repeat:
Let one instance of mysqld running on the default /var/lib/mysql, and setup another instance on /var/lib/mysql20 (for instance).
Start the first instance, it will create /var/lib/mysql/mysql.sock
When you start the second instance (with the option
--socket=/var/lib/mysql20/mysql.sock ), mysqld_safe will delete /var/lib/mysql/mysql.sock , thus disallowing any local access (i.e., via the unix socket) to the first instance of mysqld
Suggested fix:
*** mysqld_safe Mon Dec 15 05:38:39 2003
--- /usr/bin/mysqld_safe        Sun Dec  7 07:07:08 2003
*************** else
*** 115,119 ****
  fi
- safe_mysql_unix_port=${mysql_unix_port:-${MYSQL_UNIX_PORT:-/var/lib/mysql/mysql.sock}}
  user=mysql
  niceness=0
--- 115,118 ----
*************** args=
*** 150,153 ****
--- 149,153 ----
  parse_arguments `$print_defaults --loose-verbose $defaults mysqld server mysqld_safe safe_mysqld`
  parse_arguments PICK-ARGS-FROM-ARGV "$@"
+ safe_mysql_unix_port=${mysql_unix_port:-${MYSQL_UNIX_PORT:-/var/lib/mysql/mysql.sock}}
  if test ! -x $ledir/$MYSQLD
  
 
 
 
Description: mysqld_safe deletes mysql.sock when starting. When you have more than one instance of mysqld running on the same machine, when you start the second instance, it deletes always /var/lib/mysql.sock, because the variable safe_mysql_unix_port is set before parsing all the command-line arguments. Look at the diff -p2 I´m attaching with this report. It solved the problem for me, as with the patch, the variable is correctly set when you use the --socket option in the command-line. How to repeat: Let one instance of mysqld running on the default /var/lib/mysql, and setup another instance on /var/lib/mysql20 (for instance). Start the first instance, it will create /var/lib/mysql/mysql.sock When you start the second instance (with the option --socket=/var/lib/mysql20/mysql.sock ), mysqld_safe will delete /var/lib/mysql/mysql.sock , thus disallowing any local access (i.e., via the unix socket) to the first instance of mysqld Suggested fix: *** mysqld_safe Mon Dec 15 05:38:39 2003 --- /usr/bin/mysqld_safe Sun Dec 7 07:07:08 2003 *************** else *** 115,119 **** fi - safe_mysql_unix_port=${mysql_unix_port:-${MYSQL_UNIX_PORT:-/var/lib/mysql/mysql.sock}} user=mysql niceness=0 --- 115,118 ---- *************** args= *** 150,153 **** --- 149,153 ---- parse_arguments `$print_defaults --loose-verbose $defaults mysqld server mysqld_safe safe_mysqld` parse_arguments PICK-ARGS-FROM-ARGV "$@" + safe_mysql_unix_port=${mysql_unix_port:-${MYSQL_UNIX_PORT:-/var/lib/mysql/mysql.sock}} if test ! -x $ledir/$MYSQLD