Startup and shutdown of MySQL server under Linux

Source: Internet
Author: User
Tags chmod local time unix domain socket

One, running the MySQL server as a non-privileged user

Before discussing how to start the MySQL server, let's consider what the user should be running the MySQL server. The server can be started manually or automatically. If you start it manually, the server starts as a user who is logged into Unix (Linux), which runs with Paul if you log in to UNIX and starts the server, and if you switch to root with the SU command and then start the server, it runs as root. However, most of the time you may not want to start the server manually, most likely you are scheduling the MySQL server to start automatically when the system boots, as part of the standard boot process, under UNIX, this boot process is performed by the UNIX user root of the system, And any processes running in the process are run with root privileges.

You should keep in mind the two goals of the MySQL server startup process:

    • You want to have the server run as a non-root user. In general, you want to limit the ability of any running process, unless you really need root permission, and MySQL does not need it.
    • You want the server to always run with the same user, it is inconvenient to use one user while running the server with a different user at another time, which causes the files and directories to be created under a different master data directory, and may cause the server to be unable to access the database or table, depending on which user you are running. Unified running the server with the same user is the problem you avoid.

To run the server with a normal, non-privileged user, follow these steps:

    1. Select a user to run the server, and Mysqld can run with any user. However, it is conceptually clearer to create a separate user for the MySQL operation. You can also select a user group specifically for MySQL. This article uses Mysqladm and MYSQLGRP as the user name and user group name, respectively.
      If you have MySQL installed under your account and do not have special administrative privileges on your system, you will probably run the server under your own user ID. In this case, use your own login name and user group instead of Mysqladm and MYSQLGRP.
      If you install MySQL on Redhat Linux with RPM files, the installation will automatically create an account named MySQL, replacing Mysqladm with that account.
    2. If necessary, create a server account with the system's usual process of creating a user, you need to do it with root.
    3. If the server is running, stop it.
    4. Modify the Data directory and the owner of any subdirectories and files so that mysqladm users have them. For example, if the data directory is/usr/local/var, you can set the owner of the Mysqladm as follows (you need to run these commands as root):

      #cd/usr/local/var
      #chown-R MYSQLADM.MYSQLGRP
    5. Modify the permissions of the data directory and any subdirectories and files so that they can only be accessed by mysqladm users. If the data directory is/usr/local/var, you can set anything owned by Mysqladm:

      # Cd/usr/local/var
      # Chmod-r GO-RWX

Note the symbolic connection when you set the owner and mode of the data directory and its contents. You need to follow them and change the owner and mode of the file or directory they point to. If the directory of connected files is located in a place that does not belong to you, you may be in trouble, you might need root status.

After you have completed the process, you should ensure that the server is always started when logged on with mysqladm or root, and in the latter case, determine the specified--user=mysqladm option so that the server can switch its user ID to Mysqladm (and also for the system boot process).

The--user option is introduced in MySQL 3.22, and if you have an older version, you can use the SU command to tell the system to run the server under a specific user as root.

Second, the method of starting the server

After we have identified the account used to run the server, you can choose how to schedule the server to start. You can run it automatically from the command line, either manually or during the system boot process. There are three primary methods for starting the server:

    • Call Mysqld directly.
      This is probably the least common method and is not recommended to use much, so this article is not detailed.
    • Call the Safe_mysqld script.
      Safe_mysqld attempts to determine the location of the server program and data directory. The server is then invoked with the option to reflect these values. Safe_mysqld to relocate a standard error device from the server to an error file in the data directory, making it a record. After starting the server, SAFE_MYSQLD also monitors it and restarts it if it dies. Safe_mysqld is commonly used in BSD-style UNIX systems.
      If you start sqfe_mysqld as root or during system boot, the error log is owned by root, which may cause "permission denied" (Permission denied) errors when you later attempt to invoke Safe_mysqld with a non-privileged user. Delete the error log and try again.
    • Call the Mysql.server script.
      This script starts the server by using Safe_mysqld.mysql.server on the System V start and stop systems, which contains several script directories that are used when the machine enters or exits a given runlevel. It can use a start or stop parameter to indicate whether you want to start or stop the server.

The Safe_mysqld script is installed in the bin directory of the MySQL installation directory, or can be found under the scripts directory of the MySQL source code distribution. The Mysql.server script is installed in the Share/mysqld directory under the MySQL installation directory or can be found under the Support_files directory of the MySQL source code distribution. If you want to use them, you need to copy them to the appropriate directory.

For BSD-style systems (FREEBSD,OPENBSD, etc.), there are usually several files in the/etc directory that initialize the service at boot time, these files usually have names that begin with "RC", and it is possible to have a file called "rc.local" (or something like that), Intentionally used to start a locally installed service. On such a system, you might add a line like the following to the Rc.local file to start the server (if the Safe_mysqld directory is different on your system, modify it):

if [-x/usr/local/bin/safe_mysqld]; Then  /usr/local/bin/safe_mysqld &fi

For System V-style systems, you can install it by placing the mysql.server in the appropriate startup directory under/etc. If you run Linux and install MySQL from a rpm file, this is done for you, otherwise install the script in the main startup directory and place the connection to it in the appropriate RunLevel directory. You can also make the script bootable only by Root.

The directory layout of the startup files is different for each system, so you need to check to see how your system organizes them. For example, on Linux PPC, directories are/ETC/RC.D and/ETC/RC.D/RC3.D, so you can install scripts like this:

#cp Mysql.server/etc/rc.d/init.d#cd/etc/init.d#chmod mysql.server#cd/etc/rc.d/rc3.d#ln-s. /init.d/mysql.server S99mysql

On Solaris, the main script directory is/ETC/INIT.D, and the run-level directory is/etc/rd2.d, so the command looks like this:

#cp Mysql.server/etc/rc.d/init.d#cd/etc/init.d#chmod mysql.server#cd/etc/rc2.d#ln-s. /init.d/mysql.server S99mysql

When the system starts, the S99mysql script is automatically called with a start parameter. If you have a chkconfig command (available on Linux), you can help install the Mysql.server script instead of running the above command manually as above.

2.1 Specifying startup options

If you want to specify additional startup options when the server starts, you can do so in two ways. You can modify the startup script you use (SAFE_MYSQLD or Mysql.server) and specify options directly on the row that invokes the server, or in one of the options files. It is recommended that if you specify an option in a global options file, it is typically located in/etc/my.cnf (Unix) or c:\my.cnf (Windows).

Some kinds of information cannot be specified with the server option. For these you may need to modify safe_mysqld. For example, if your server does not correctly select the local time zone and returns a time value in GMT, you can set the TZ environment variable to give it an indication. If you start the server with Safe_mysqld or mysql.server, you can add a time zone setting to Safe_mysqld. Locate the row that started the server and add the following command before the row:

Tz=us/centralexport TZ

The syntax for the above command is Solaris and may be different for other system syntax, please consult the relevant manual. If you do modify your startup script, remember that the next time you install MySQL (such as upgrading to a new version), your changes will be lost unless you first copy the startup script elsewhere. After installing the new version, compare the old and new versions of the script to see what changes you need to rebuild.

2.2 Check your table at startup

In addition to scheduling your server to boot at system boot, you may want to install the MYISAMCHK and Isamchk scripts to check your tables before the server starts. You may restart after a crash, it is possible that the table has been compromised, and checking it before booting is a good way to find the problem.

Third, stop the server

To start the server manually, use Mysqladmin:

%mysqladmin shutdown

To stop the server automatically, you don't need to do anything special. BSD systems generally stop the service by sending a term signal to the process, which either correctly responds to it or is brutally killed. The mysqld is terminated as a response when it receives the signal. For System V-style systems that start the server with Mysql.server, the stop process invokes the script with a stop parameter, telling the server to terminate, and of course assuming that you have installed Mysql.server.

Iv. how to regain control of the server if you cannot connect to the server

In some cases, you may manually restart the server because you cannot connect to it. Of course, this is a bit contradictory. Because you usually turn it off manually by connecting to the server, how does this happen?

First, the MySQL root password can already be set to a value that you do not know, which may occur when you change the password, for example, if you accidentally type a control character that is not visible when you enter a new password. You may also forget your password.

Second, the connection localhost is usually done through a UNIX domain socket file, typically/tmp/mysql.sock. If the socket file is deleted, the local client cannot connect. This can happen when your system runs a cron task that deletes the temp file under/tmp.

If you are unable to connect because of a missing socket file, you can simply recreate it by restarting the server. Because the server re-creates it at startup. The trick here is that you can't connect with sockets because it's gone, you have to establish a TCP/IP connection, for example, if the server host is pit.snake.net, you can connect like this:

%mysqladmin-p-u root-h pit.snake.net shutdown

If a socket file is deleted by a cron task, the problem recurs, unless you modify the cron task or use one or a different socket file, you can use the global options file to specify a different socket, for example, if the data directory is/usr/local/var, You can move the socket file there by adding the following line to/ETC/MY.CNF:

[Mysqld]socket=/usr/local/var/mysql.sock[client]socket=/usr/local/var/mysql.sock

Path names are specified for both the server and the client so that they all use the same socket file. If you set the path only for the server, the client will still expect the socket to be executed in its original location, restart the server after the modification, and make it create the socket in the new location.

If you cannot connect because you have forgotten the root password or have set it to a different value than you think, you need to regain control of the server, you can set the password again:

    • Interrupt Server
      If you log on to the server host as root, you can terminate the server with the KILL command. You can find the ID of the server process using the PS command or by looking for the server's PID file (usually in the data directory).
      It is best to first try a normal kill that emits a term signal to the server to see if it will respond with a normal termination. In this way, the tables and logs will be emptied correctly. If the server is blocked and does not answer a normal termination signal, you can force it to terminate with kill-9. This is the last resort, because it may have an unmodified change, and you risk putting the table in an inconsistent state.
      If you use Kill-9 to terminate the server, make sure to check your table with Myisamchk and ISAMCHK before starting the server.
    • Restart the server with the--skip-grant-table option.
      This tells the server not to use the authorization table to authenticate the connection, which allows you to connect as root without a password. After you have connected, change the root password.
    • Use Mysqladmin flush-privileges to tell the server to start again with the authorization table
      If your mysqladmin version does not know Flash-privileges, try reload.
Five. Running multiple servers

Most of them run a single MySQL server on a given machine, but in many cases it is useful to run multiple servers:

    • You may want to test a new version of a server and keep the production server you are running. In this case, you will run a different server code.
    • The operating system generally restricts the number of open file handles per process. If your system is having difficulty raising this limit, running multiple servers is one way to address the limitations. In this scenario, you may run multiple instances of the unified server.
    • ISPs often provide their customers with their own MySQL installation, and it is necessary to involve separate servers. In this case, you may run multiple instances of the same version or different versions if different customers want different versions of MySQL.

Naturally, it is much more complex to run multiple servers than to run only one server. If you install multiple versions, you can't install everything in the same place. When the server is running, some parameters must or most likely be unique to each server, including where the server is installed, the pathname of its data directory, the TCP/IP port and the UNIX domain socket path name, and the UNIX account used to run the server (if you are no longer running all servers under the same account). If you decide to run multiple servers, be aware of the parameters you use, and you will not lose track of what's going on.

5.1 Configuring and installing multiple servers

If you want to run different versions of the server instead of multiple instances of the same version, you must install them in different locations. If you install binary distribution (without RPM), they will be installed under a directory with different version numbers. If you install from source code, the simplest way is to run configure configuration in each version of the MySQL installation process using the--WITH-PREFIX option to separate the different distributions, which will allow everything to be installed in a separate directory, you can link the directory domain distribution version number, for example, You can configure a MySQL distribution like this, where version is the MySQL release number:

%.configure--with-prefix=/usr/local/mysql-version
The--with-prefix option also determines a unique data directory for the server. You may want to add other server-specific options, such as the TCP/IP port number and socket pathname (--with-tcp-port and--with-unix-socket).

If you want to run multiple instances of the same version server, any option that must be based on a server-specific setting will need to be specified at run time.

5.2 Multi-server boot process

Starting multiple servers is more complex than using a single server. Because both Safe_mysqld and mysql.server work best on a single server setup. It is recommended that you take a closer look at safe_mysqld and use it as the basis for your startup process, using your modified version, and you can tailor it more precisely to your own needs.

One problem you have to deal with is how to specify options in the options file (MY.CNF). For multiple servers, you cannot use/ETC/MY.CNF for each of the different server settings, and you can use the file only for the same settings for all servers. If the server has a different compiled data directory location, you can specify the settings to be used by all servers in MY.CNF in each server data directory, and use DATADIR/MY.CNF to specify server-specific settings, where DataDir differs by server.

Another way to specify a server option is to use--default-file=path_name as the first option on the command line to tell the server to read the option from a file named Path_name so that you can place a server option in a file that is unique to that server. It then tells the server to read the file at startup. Note that if you specify this option, you will not use any one of the usual options files such as/ETC/MY.CNF.

One, running the MySQL server as a non-privileged user

Before discussing how to start the MySQL server, let's consider what the user should be running the MySQL server. The server can be started manually or automatically. If you start it manually, the server starts as a user who is logged into Unix (Linux), which runs with Paul if you log in to UNIX and starts the server, and if you switch to root with the SU command and then start the server, it runs as root. However, most of the time you may not want to start the server manually, most likely you are scheduling the MySQL server to start automatically when the system boots, as part of the standard boot process, under UNIX, this boot process is performed by the UNIX user root of the system, And any processes running in the process are run with root privileges.

You should keep in mind the two goals of the MySQL server startup process:

    • You want to have the server run as a non-root user. In general, you want to limit the ability of any running process, unless you really need root permission, and MySQL does not need it.
    • You want the server to always run with the same user, it is inconvenient to use one user while running the server with a different user at another time, which causes the files and directories to be created under a different master data directory, and may cause the server to be unable to access the database or table, depending on which user you are running. Unified running the server with the same user is the problem you avoid.

To run the server with a normal, non-privileged user, follow these steps:

    1. Select a user to run the server, and Mysqld can run with any user. However, it is conceptually clearer to create a separate user for the MySQL operation. You can also select a user group specifically for MySQL. This article uses Mysqladm and MYSQLGRP as the user name and user group name, respectively.
      If you have MySQL installed under your account and do not have special administrative privileges on your system, you will probably run the server under your own user ID. In this case, use your own login name and user group instead of Mysqladm and MYSQLGRP.
      If you install MySQL on Redhat Linux with RPM files, the installation will automatically create an account named MySQL, replacing Mysqladm with that account.
    2. If necessary, create a server account with the system's usual process of creating a user, you need to do it with root.
    3. If the server is running, stop it.
    4. Modify the Data directory and the owner of any subdirectories and files so that mysqladm users have them. For example, if the data directory is/usr/local/var, you can set the owner of the Mysqladm as follows (you need to run these commands as root):

      #cd/usr/local/var
      #chown-R MYSQLADM.MYSQLGRP
    5. Modify the permissions of the data directory and any subdirectories and files so that they can only be accessed by mysqladm users. If the data directory is/usr/local/var, you can set anything owned by Mysqladm:

      # Cd/usr/local/var
      # Chmod-r GO-RWX

Note the symbolic connection when you set the owner and mode of the data directory and its contents. You need to follow them and change the owner and mode of the file or directory they point to. If the directory of connected files is located in a place that does not belong to you, you may be in trouble, you might need root status.

After you have completed the process, you should ensure that the server is always started when logged on with mysqladm or root, and in the latter case, determine the specified--user=mysqladm option so that the server can switch its user ID to Mysqladm (and also for the system boot process).

The--user option is introduced in MySQL 3.22, and if you have an older version, you can use the SU command to tell the system to run the server under a specific user as root.

Second, the method of starting the server

After we have identified the account used to run the server, you can choose how to schedule the server to start. You can run it automatically from the command line, either manually or during the system boot process. There are three primary methods for starting the server:

    • Call Mysqld directly.
      This is probably the least common method and is not recommended to use much, so this article is not detailed.
    • Call the Safe_mysqld script.
      Safe_mysqld attempts to determine the location of the server program and data directory. The server is then invoked with the option to reflect these values. Safe_mysqld to relocate a standard error device from the server to an error file in the data directory, making it a record. After starting the server, SAFE_MYSQLD also monitors it and restarts it if it dies. Safe_mysqld is commonly used in BSD-style UNIX systems.
      If you start sqfe_mysqld as root or during system boot, the error log is owned by root, which may cause "permission denied" (Permission denied) errors when you later attempt to invoke Safe_mysqld with a non-privileged user. Delete the error log and try again.
    • Call the Mysql.server script.
      This script starts the server by using Safe_mysqld.mysql.server on the System V start and stop systems, which contains several script directories that are used when the machine enters or exits a given runlevel. It can use a start or stop parameter to indicate whether you want to start or stop the server.

The Safe_mysqld script is installed in the bin directory of the MySQL installation directory, or can be found under the scripts directory of the MySQL source code distribution. The Mysql.server script is installed in the Share/mysqld directory under the MySQL installation directory or can be found under the Support_files directory of the MySQL source code distribution. If you want to use them, you need to copy them to the appropriate directory.

For BSD-style systems (FREEBSD,OPENBSD, etc.), there are usually several files in the/etc directory that initialize the service at boot time, these files usually have names that begin with "RC", and it is possible to have a file called "rc.local" (or something like that), Intentionally used to start a locally installed service. On such a system, you might add a line like the following to the Rc.local file to start the server (if the Safe_mysqld directory is different on your system, modify it):

if [-x/usr/local/bin/safe_mysqld]; Then  /usr/local/bin/safe_mysqld &fi

For System V-style systems, you can install it by placing the mysql.server in the appropriate startup directory under/etc. If you run Linux and install MySQL from a rpm file, this is done for you, otherwise install the script in the main startup directory and place the connection to it in the appropriate RunLevel directory. You can also make the script bootable only by Root.

The directory layout of the startup files is different for each system, so you need to check to see how your system organizes them. For example, on Linux PPC, directories are/ETC/RC.D and/ETC/RC.D/RC3.D, so you can install scripts like this:

#cp Mysql.server/etc/rc.d/init.d#cd/etc/init.d#chmod mysql.server#cd/etc/rc.d/rc3.d#ln-s. /init.d/mysql.server S99mysql

On Solaris, the main script directory is/ETC/INIT.D, and the run-level directory is/etc/rd2.d, so the command looks like this:

#cp Mysql.server/etc/rc.d/init.d#cd/etc/init.d#chmod mysql.server#cd/etc/rc2.d#ln-s. /init.d/mysql.server S99mysql

When the system starts, the S99mysql script is automatically called with a start parameter. If you have a chkconfig command (available on Linux), you can help install the Mysql.server script instead of running the above command manually as above.

2.1 Specifying startup options

If you want to specify additional startup options when the server starts, you can do so in two ways. You can modify the startup script you use (SAFE_MYSQLD or Mysql.server) and specify options directly on the row that invokes the server, or in one of the options files. It is recommended that if you specify an option in a global options file, it is typically located in/etc/my.cnf (Unix) or c:\my.cnf (Windows).

Some kinds of information cannot be specified with the server option. For these you may need to modify safe_mysqld. For example, if your server does not correctly select the local time zone and returns a time value in GMT, you can set the TZ environment variable to give it an indication. If you start the server with Safe_mysqld or mysql.server, you can add a time zone setting to Safe_mysqld. Locate the row that started the server and add the following command before the row:

Tz=us/centralexport TZ

The syntax for the above command is Solaris and may be different for other system syntax, please consult the relevant manual. If you do modify your startup script, remember that the next time you install MySQL (such as upgrading to a new version), your changes will be lost unless you first copy the startup script elsewhere. After installing the new version, compare the old and new versions of the script to see what changes you need to rebuild.

2.2 Check your table at startup

In addition to scheduling your server to boot at system boot, you may want to install the MYISAMCHK and Isamchk scripts to check your tables before the server starts. You may restart after a crash, it is possible that the table has been compromised, and checking it before booting is a good way to find the problem.

Third, stop the server

To start the server manually, use Mysqladmin:

%mysqladmin shutdown

To stop the server automatically, you don't need to do anything special. BSD systems generally stop the service by sending a term signal to the process, which either correctly responds to it or is brutally killed. The mysqld is terminated as a response when it receives the signal. For System V-style systems that start the server with Mysql.server, the stop process invokes the script with a stop parameter, telling the server to terminate, and of course assuming that you have installed Mysql.server.

Iv. how to regain control of the server if you cannot connect to the server

In some cases, you may manually restart the server because you cannot connect to it. Of course, this is a bit contradictory. Because you usually turn it off manually by connecting to the server, how does this happen?

First, the MySQL root password can already be set to a value that you do not know, which may occur when you change the password, for example, if you accidentally type a control character that is not visible when you enter a new password. You may also forget your password.

Second, the connection localhost is usually done through a UNIX domain socket file, typically/tmp/mysql.sock. If the socket file is deleted, the local client cannot connect. This can happen when your system runs a cron task that deletes the temp file under/tmp.

If you are unable to connect because of a missing socket file, you can simply recreate it by restarting the server. Because the server re-creates it at startup. The trick here is that you can't connect with sockets because it's gone, you have to establish a TCP/IP connection, for example, if the server host is pit.snake.net, you can connect like this:

%mysqladmin-p-u root-h pit.snake.net shutdown

If a socket file is deleted by a cron task, the problem recurs, unless you modify the cron task or use one or a different socket file, you can use the global options file to specify a different socket, for example, if the data directory is/usr/local/var, You can move the socket file there by adding the following line to/ETC/MY.CNF:

[Mysqld]socket=/usr/local/var/mysql.sock[client]socket=/usr/local/var/mysql.sock

Path names are specified for both the server and the client so that they all use the same socket file. If you set the path only for the server, the client will still expect the socket to be executed in its original location, restart the server after the modification, and make it create the socket in the new location.

If you cannot connect because you have forgotten the root password or have set it to a different value than you think, you need to regain control of the server, you can set the password again:

    • Interrupt Server
      If you log on to the server host as root, you can terminate the server with the KILL command. You can find the ID of the server process using the PS command or by looking for the server's PID file (usually in the data directory).
      It is best to first try a normal kill that emits a term signal to the server to see if it will respond with a normal termination. In this way, the tables and logs will be emptied correctly. If the server is blocked and does not answer a normal termination signal, you can force it to terminate with kill-9. This is the last resort, because it may have an unmodified change, and you risk putting the table in an inconsistent state.
      If you use Kill-9 to terminate the server, make sure to check your table with Myisamchk and ISAMCHK before starting the server.
    • Restart the server with the--skip-grant-table option.
      This tells the server not to use the authorization table to authenticate the connection, which allows you to connect as root without a password. After you have connected, change the root password.
    • Use Mysqladmin flush-privileges to tell the server to start again with the authorization table
      If your mysqladmin version does not know Flash-privileges, try reload.
Five. Running multiple servers

Most of them run a single MySQL server on a given machine, but in many cases it is useful to run multiple servers:

    • You may want to test a new version of a server and keep the production server you are running. In this case, you will run a different server code.
    • The operating system generally restricts the number of open file handles per process. If your system is having difficulty raising this limit, running multiple servers is one way to address the limitations. In this scenario, you may run multiple instances of the unified server.
    • ISPs often provide their customers with their own MySQL installation, and it is necessary to involve separate servers. In this case, you may run multiple instances of the same version or different versions if different customers want different versions of MySQL.

Naturally, it is much more complex to run multiple servers than to run only one server. If you install multiple versions, you can't install everything in the same place. When the server is running, some parameters must or most likely be unique to each server, including where the server is installed, the pathname of its data directory, the TCP/IP port and the UNIX domain socket path name, and the UNIX account used to run the server (if you are no longer running all servers under the same account). If you decide to run multiple servers, be aware of the parameters you use, and you will not lose track of what's going on.

5.1 Configuring and installing multiple servers

If you want to run different versions of the server instead of multiple instances of the same version, you must install them in different locations. If you install binary distribution (without RPM), they will be installed under a directory with different version numbers. If you install from source code, the simplest way is to run configure configuration in each version of the MySQL installation process using the--WITH-PREFIX option to separate the different distributions, which will allow everything to be installed in a separate directory, you can link the directory domain distribution version number, for example, You can configure a MySQL distribution like this, where version is the MySQL release number:

%.configure--with-prefix=/usr/local/mysql-version
The--with-prefix option also determines a unique data directory for the server. You may want to add other server-specific options, such as the TCP/IP port number and socket pathname (--with-tcp-port and--with-unix-socket).

If you want to run multiple instances of the same version server, any option that must be based on a server-specific setting will need to be specified at run time.

5.2 Multi-server boot process

Starting multiple servers is more complex than using a single server. Because both Safe_mysqld and mysql.server work best on a single server setup. It is recommended that you take a closer look at safe_mysqld and use it as the basis for your startup process, using your modified version, and you can tailor it more precisely to your own needs.

One problem you have to deal with is how to specify options in the options file (MY.CNF). For multiple servers, you cannot use/ETC/MY.CNF for each of the different server settings, and you can use the file only for the same settings for all servers. If the server has a different compiled data directory location, you can specify the settings to be used by all servers in MY.CNF in each server data directory, and use DATADIR/MY.CNF to specify server-specific settings, where DataDir differs by server.

Another way to specify a server option is to use--default-file=path_name as the first option on the command line to tell the server to read the option from a file named Path_name so that you can place a server option in a file that is unique to that server. It then tells the server to read the file at startup. Note that if you specify this option, you will not use any one of the usual options files such as/ETC/MY.CNF.

Startup and shutdown of MySQL server under Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.