MySQL startup script
#!/bin/bash
mysql_port=3308
Mysql_username= "Admin"
mysql_password= "Password"
Function_start_mysql ()
{
printf "Starting mysql...\n"
/bin/sh/usr/local/mysql/bin/mysqld_safe--defaults-file=/data/dbdata_${mysql_port}/my.cnf 2>&1 >/dev/ Null &
}
Function_stop_mysql ()
{
printf "stoping mysql...\n"
/usr/local/mysql/bin/mysqladmin-u ${mysql_username}-p${mysql_password}-s/data/dbdata_${mysql_port}/mysql.sock Shutdown
}
Function_restart_mysql ()
{
printf "Restarting mysql...\n"
Function_stop_mysql
Function_start_mysql
}
Function_kill_mysql ()
{
Kill-9 $ (Ps-ef | grep ' Bin/mysqld_safe ' | grep ${mysql_port} | awk ' {printf} ')
Kill-9 $ (Ps-ef | grep ' Libexec/mysqld ' | grep ${mysql_port} | awk ' {printf} ')
}
Case $ in
Start
Function_start_mysql;;
Stop
Function_stop_mysql;;
Kill
Function_kill_mysql;;
Restart
Function_stop_mysql
Function_start_mysql;;
*)
echo "Usage:/data/dbdata_${mysql_port}/mysqld {start|stop|restart|kill}";;
Esac
MySQL startup script