Learning Mysql


--socket=/mysql/data/mysql.sock \



Download 4.24 Mb.
View original pdf
Page52/366
Date04.08.2023
Size4.24 Mb.
#61806
1   ...   48   49   50   51   52   53   54   55   ...   366
Learning MySQL
--socket=
/mysql/data/mysql.sock \

--user=root \
--password=the_mysql_root_password \
shutdown
Configuring MySQL for automatic start
If you’re planning to use MySQL a lot, you’ll probably want to have the server start automatically every time your computer is switched on. The typical way to do this is to calla script to start and stop the MySQL server when the computer is started and stopped.
Installing Under Linux | 49

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 Here, the system is in runlevel A program is started automatically fora particular runlevel if there’s a startup entry for it in the corresponding /etc/rc.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 shutdown. 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 off off on on on 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 Configuration program by choosing the Services entry from the Administration submenu of the
System menu you can also run this program by typing

Download 4.24 Mb.

Share with your friends:
1   ...   48   49   50   51   52   53   54   55   ...   366




The database is protected by copyright ©ininet.org 2024
send message

    Main page