The mysql.server
script can be used to start or stop the server,
by invoking it with start
or stop
arguments:
shell> mysql.server start
shell> mysql.server stop
mysql.server
can be found in the `share/mysql' directory
under the MySQL installation directory, or in the `support-files'
directory of the MySQL source tree.
Before mysql.server
starts the server, it changes directory to
the MySQL installation directory, then invokes
safe_mysqld
. You might need to edit mysql.server
if you
have a binary distribution that you've installed in a non-standard
location. Modify it to cd
into the proper directory before it
runs safe_mysqld
. If you want the server to run as some specific
user, you can change the mysql_daemon_user=root
line to use
another user. You can also modify mysql.server
to pass other
options to safe_mysqld
.
mysql.server stop
brings down server by sending a signal to it.
You can take down the server manually by executing mysqladmin shutdown
.
You might want to add these start and stop commands to the appropriate places
in your `/etc/rc*' files when you start using MySQL for
production applications. Note that if you modify mysql.server
, then
if you upgrade MySQL sometime, your modified version will be
overwritten, so you should make a copy of your edited version that you can
reinstall.
If your system uses `/etc/rc.local' to start external scripts, you
should append the following to it:
/bin/sh -c 'cd /usr/local/mysql ; ./bin/safe_mysqld &'
You can also add options or mysql.server
in a global
`/etc/my.cnf' file. A typical `/etc/my.cnf' file might look like
this:
[mysqld]
datadir=/usr/local/mysql/var
socket=/tmp/mysqld.sock
port=3306
[mysql.server]
user=mysql
basedir=/usr/local/mysql
The mysql.server
script uses the following variables:
user
, datadir
, basedir
, bindir
and pid-file
.
4.15.4 Fichier d'options.