3 # mysql A very fast and reliable SQL database engine
5 # chkconfig: 2345 90 90
7 # description: A very fast and reliable SQL database engine.
9 # pidfile: /var/state/mysql/mysqld.pid
11 # Source function library
12 . /etc/rc.d/init.d/functions
15 . /etc/sysconfig/network
18 [ -f /etc/sysconfig/mysql ] && . /etc/sysconfig/mysql
20 # Check that networking is up.
21 if [ "${NETWORKING}" = "no" ]; then
22 echo "WARNING: Networking is down. Mysql service can't be runed."
27 # Check if the service is already running?
28 if [ ! -f /var/lock/subsys/mysql ]; then
31 su mysql -c '/usr/bin/msqld
32 touch /var/lock/subsys/mysql
36 echo "Mysql already is running"
38 touch /var/lock/subsys/mysql
41 show Stopping mysql service
44 rm -f /var/state/mysql/mysqld.pid
45 rm -f /var/lock/subsys/mysql
55 echo "Usage: mysql {start|stop|status|restart|reload}"
59 if test -x $bindir/safe_mysqld
61 # Give extra arguments to mysqld with the my.cnf file. This script may
62 # be overwritten at next upgrade.
63 $bindir/safe_mysqld --user=$mysql_daemon_user --pid-file=$pid_file --datadir=$datadir &
65 echo "Can't execute $bindir/safe_mysqld"
70 # Stop daemon. We use a signal here to avoid having to know the
72 if test -f "$pid_file"
74 mysqld_pid=`cat $pid_file`
75 echo "Killing mysqld with pid $mysqld_pid"
77 # mysqld should remove the pid_file when it exits.
79 echo "No mysqld pid file found. Looked for $pid_file."
85 echo "usage: $0 start|stop"