Databases Reference
In-Depth Information
If you used an RPM or Debian package to install MySQL, this script is generally already
installed as /etc/init.d/mysql or /etc/init.d/mysqld (MySQL daemon). Check what this
script is called on your system using the ls command:
$ ls /etc/init.d/mysql*
/etc/init.d/mysql
In the preceding example, the file is called mysql . Use the appropriate name ( mysql or
mysqld ) where you see mysql in the commands below.
If you installed from a tarball or from source, you'll need to copy the file across yourself
as discussed in the earlier section, “Configuring a system-wide server installed from
tarball or source.”
A Linux system can start in one of six runlevels ; a system starting in runlevel 5 will
typically boot straight into the graphical windowing environment such as KDE or
GNOME, while a system starting in runlevels 2 or 3 will end up at a text-based login
screen. There's an easy way to check what runlevel you're in; just use the runlevel
program in the /sbin directory:
$ /sbin/runlevel
N 5
Here, the system is in runlevel 5.
A program is started automatically for a particular runlevel if there's a startup entry for
it in the corresponding /etc/rc<runlevel>.d directory. You can list all the entries for
MySQL by typing:
$ ls /etc/rc*.d/*mysql*
/etc/rc0.d/K90mysql /etc/rc2.d/S11mysql /etc/rc4.d/S11mysql /etc/rc6.d/K90mysql
/etc/rc1.d/K90mysql /etc/rc3.d/S11mysql /etc/rc5.d/S11mysql
The entries starting with “S” start the program when the system is booted, and the
entries starting with “K” stop (or kill) the program when the system is shut down. Here,
MySQL is set to start and stop automatically in runlevels 2, 3, 4, and 5. On Red Hat or
Mandriva systems, you can more conveniently determine this using the chkconfig
--list command:
# chkconfig --list mysql
mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
If your server shows “off” for the runlevel that you found using the runlevel command,
the MySQL server is not started automatically.
If you don't see an entry for your preferred runlevel (normally 3 or 5), you'll need to
add one yourself. Most Linux distributions have a graphical tool to configure startup
services. For example, under Red Hat and Fedora, you can run the Service Configura-
tion program by choosing the Services entry from the Administration submenu of the
System menu; you can also run this program by typing system-config-services at the
command line. Similarly, with Mandriva, you can use the Services program from the
Mandriva Control Center (select Configure Your Computer from the Configuration
 
Search WWH ::




Custom Search