mysql5.6多实例配置
#!/bin/sh# This is an interactive program, we needthe current locale
[ -f /etc/profile.d/lang.sh ] && ./etc/profile.d/lang.sh
# We can't Japanese on normal console atboot time, so force.
if [ "$LANG" = "ja" -o"$LANG" = "ja_JP.eucJP" ]; then
if [ "$TERM" = "linux" ] ; then
LANG=C
fi
fi
# Source function library.
. /etc/init.d/functions
cmdPath="/usr/local/mysql/bin"
myPath="/data/3307"
softPath="/usr/local/mysql"
socketfile="$myPath/data/mysql.sock"
my_user="root"
my_pass="123456"
start(){
if [ ! -e "$socketfile" ];then
printf "Mysqldstarting......\n"
$cmdPath/mysqld_safe--defaults-file=$myPath/my.cnf --user=mysql \
--basedir=$softPath--datadir=$myPath/data &>/dev/null &
sleep 2
else
printf "Mysqld alreadyrunning\n" && exit 1
fi
}
stop(){
if [ -e "$socketfile" ];then
printf "Mysqldstoping......\n"
$cmdPath/mysqladmin-u"$my_user" -p"$my_pass" \
-S "$socketfile" shutdown &>/dev/null
[ $? -ne 0 ] && echo"error username or password!!!" && exit 1
sleep 3
else
printf "Mysqld alreadyclosed\n" && exit 1
fi
}
restart(){
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
status mysqld
;;
*)
echo "Usage: $0{start|stop|restart|status}"
exit 1
esac
页:
[1]