至于安装MySQL的时候我是带的如下参数
./configure --prefix=/usr/local/mysql5 --localstatedir=/var/data/mysql5 --with-unix-socket-path=/tmp/mysql5.sock
这样来区分开不同的数据库的安装路径
如果还想可以使用 /etc/mysqld5 stop 之类的命令,就需要改 /etc/mysqld5 中的stop段,像下面这段代码一样(注意 pid_file='/var/data/mysql5/lookyellowpage.com.pid' #Jack added 这行是加进去了,里面的路径你可以自己指定,目的是为了运行stop时它不去取 /etc/my.cnf 变量里的内容,因为取出来的东西有可能是其它数据库服务的,有可能会出错).
'stop')
# Stop daemon. We use a signal here to avoid having to know the
# root password.
# The RedHat / SUSE lock directory to remove
lock_dir=/var/lock/subsys/mysqlmanager
# If the manager pid_file doesn't exist, try the server's
if test ! -s "$pid_file"
then
pid_file=$server_pid_file
lock_dir=/var/lock/subsys/mysql
fi
pid_file='/var/data/mysql5/lookyellowpage.com.pid' #Jack added
echo $pid_file
if test -s "$pid_file"
then
mysqlmanager_pid=`cat $pid_file`
echo $mysqlmanager_pid
echo $echo_n "Shutting down MySQL"
kill $mysqlmanager_pid
# mysqlmanager should remove the pid_file when it exits, so wait for it.
wait_for_pid removed
# delete lock for RedHat / SuSE
if test -f $lock_dir
then
rm -f $lock_dir
fi
else
log_failure_msg "MySQL manager or server PID file could not be found!"
fi
;;