MySQL Forums
Forum List  »  Install & Repo

Re: Installing MySQL 5 alongside with MySQL 4.
Posted by: Göran Törnqvist
Date: October 28, 2005 06:44AM

I solved it...after a lot of headache...
It was much more complex than it should be.

And the mysql_safe program kept insisting to start the MySQL 4 binary...
I had to change the mysql.server script a whole lot until it worked...
Below is whats working for me...could probably be written a bit cleaner but I dont have the time ;)

=====================================
#!/bin/sh

PATH=/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin
export PATH

basedir=/usr/local/mysql5
datadir=/home/mysql5
bindir=/usr/local/mysql5/bin
pid_file=/home/mysql5/goofy.pid
server_pid_file=/home/mysql5/goofy.pid
user=mysql5

#
# Use LSB init script functions for printing messages, if possible
#
lsb_functions="/lib/lsb/init-functions"
if test -f $lsb_functions ; then
source $lsb_functions
else
log_success_msg()
{
echo " SUCCESS! $@"
}
log_failure_msg()
{
echo " ERROR! $@"
}
fi

wait_for_pid () {
i=0
while test $i -lt 35 ; do
sleep 1
case "$1" in
'created')
test -s $pid_file && i='' && break
;;
'removed')
test ! -s $pid_file && i='' && break
;;
*)
echo "wait_for_pid () usage: wait_for_pid created|removed"
exit 1
;;
esac
echo $echo_n ".$echo_c"
i=`expr $i + 1`
done

if test -z "$i" ; then
log_success_msg
else
log_failure_msg
fi
}

case "$1" in
'start')
# Start daemon

echo $echo_n "Starting MySQL5"
# may be overwritten at next upgrade.
pid_file=$server_pid_file
/usr/local/mysql5/bin/mysqld_safe --defaults-file=/etc/my5.cnf --user=$user --port=3305 --datadir=$datadir --pid-file=$server_pid_file --log-error=/var/log/mysqld5.log --ledir=/usr/local/mysql5/bin >/dev/null 2>&1 &
wait_for_pid created

;;

'stop')
# Stop daemon. We use a signal here to avoid having to know the
# root password.

# If the manager pid_file doesn't exist, try the server's
if test ! -s "$pid_file"
then
pid_file=$server_pid_file
fi

if test -s "$pid_file"
then
mysqlmanager_pid=`cat $pid_file`
echo $echo_n "Shutting down MySQL5"
kill $mysqlmanager_pid
# mysqlmanager should remove the pid_file when it exits, so wait for it.
wait_for_pid removed

else
log_failure_msg "MySQL manager or server PID file could not be found!"
fi
;;

'restart')
# Stop the service and regardless of whether it was
# running or not, start it again.
$0 stop
$0 start
;;

'reload')
if test -s "$server_pid_file" ; then
mysqld_pid=`cat $server_pid_file`
kill -HUP $mysqld_pid && log_success_msg "Reloading service MySQL"
touch $server_pid_file
else
log_failure_msg "MySQL PID file could not be found!"
fi
;;

*)
# usage
echo "Usage: $0 start|stop|restart|reload"
exit 1
;;
esac

Options: ReplyQuote


Subject
Written By
Posted
Re: Installing MySQL 5 alongside with MySQL 4.
October 28, 2005 06:44AM


Sorry, you can't reply to this topic. It has been closed.

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.