Installation guide

Section 5.3:Setting Up a MySQL Service 93
# Mysql daemon start/stop script.
# Usually this is put in /etc/init.d (at least on machines SYSV R4
# based systems) and linked to /etc/rc3.d/S99mysql. When this is done
# the mysql server will be started when the machine is started.
# Comments to support chkconfig on RedHat Linux
# chkconfig: 2345 90 90
# description: A very fast and reliable SQL database engine.
PATH=/sbin:/usr/sbin:/bin:/usr/bin
basedir=/var/mysql
bindir=/var/mysql/bin
datadir=/var/mysql/var
pid_file=/var/mysql/var/mysqld.pid
mysql_daemon_user=root # Run mysqld as this user.
export PATH
mode=$1
if test -w / # determine if we should look at the root config file
then # or user config file
conf=/etc/my.cnf
else
conf=$HOME/.my.cnf # Using the users config file
fi
# The following code tries to get the variables safe_mysqld needs from the
# config file. This isn’t perfect as this ignores groups, but it should
# work as the options doesn’t conflict with anything else.
if test -f "$conf" # Extract those fields we need from config file.
then
if grep "^datadir" $conf > /dev/null
then
datadir=‘grep "^datadir" $conf | cut -f 2 -d= | tr -d ’ ’‘
fi
if grep "^user" $conf > /dev/null
then
mysql_daemon_user=‘grep "^user" $conf | cut -f 2 -d= | tr -d ’ ’ | head -1‘
fi
if grep "^pid-file" $conf > /dev/null
then
pid_file=‘grep "^pid-file" $conf | cut -f 2 -d= | tr -d ’ ’‘