content_image/862715.jpg
<img src='content_image/862715.jpg'>

## Note 

For some Linux platforms, MySQL installation from RPM or Debian packages includes systemd support for managing MySQL server startup and shutdown. On these platforms, mysql.server  and mysqld_safe  are not installed because they are unnecessary. For more information, see Section 2.5.9, “Managing MySQL Server with systemd” . 

To start or stop the server manually using the mysql.server  script, invoke it from the command line with start  or stop  arguments: 

mysql.server start mysql.server stop 

mysql.server  changes location to the MySQL installation directory, then invokes mysqld_safe . To run the server as some specific user, add an appropriate user  option to the [mysqld]  group of the global / etc/my.cnf  option file, as shown later in this section. (It is possible that you must edit mysql.server  if you’ve installed a binary distribution of MySQL in a nonstandard location. Modify it to change location into the proper directory before it runs mysqld_safe . If you do this, your modified version of mysql.server may be overwritten if you upgrade MySQL in the future; make a copy of your edited version that you can reinstall.) 

mysql.server stop  stops the server by sending a signal to it. You can also stop the server manually by executing mysqladmin shutdown . 

To start and stop MySQL automatically on your server, you must add start and stop commands to the appropriate places in your /etc/rc*  files: 

•If you use the Linux server RPM package ( MySQL-server- VERSION .rpm ), or a native Linux package installation, the mysql.server  script may be installed in the /etc/init.d  directory with the name mysqld  or mysql . See Section 2.5.4, “Installing MySQL on Linux Using RPM Packages from Oracle” , for more information on the Linux RPM packages. 

•If you install MySQL from a source distribution or using a binary distribution format that does not install mysql.server  automatically, you can install the script manually. It can be found in the support- files  directory under the MySQL installation directory or in a MySQL source tree. Copy the script to the /etc/init.d  directory with the name mysql  and make it executable: 

cp mysql.server /etc/init.d/mysql chmod +x /etc/init.d/mysql 

After installing the script, the commands needed to activate it to run at system startup depend on your operating system. On Linux, you can use chkconfig : 

chkconfig --add mysql 

On some Linux systems, the following command also seems to be necessary to fully enable the mysql script: 

chkconfig --level 345 mysql on 

•On FreeBSD, startup scripts generally should go in /usr/local/etc/rc.d/ . Install the mysql.server  script as /usr/local/etc/rc.d/mysql.server.sh  to enable automatic startup. The rc(8)  manual page states that scripts in this directory are executed only if their base name matches the *.sh  shell file name pattern. Any other files or directories present within the directory are silently ignored. 

