MySQL configuration file notes

Source: Internet
Author: User


MySQL configuration file notes provide options for the program in the following ways when starting the MySQL server or using the MySQL client program: · Provide options after the program name in the command line. Www.2cto.com. · Set in environment variables. The MySQL program first checks the environment variables, then checks the configuration file, and then checks the command line to determine which options are provided. If one option is specified multiple times, the last option appears first. This indicates that the environment variable has the lowest priority and the command line option has the highest priority. In the preceding method, the configuration file is the most complex. Configuration File Usage in Linux, MySQL program reads the startup option from the following file: file name destination/etc/my. cnf Global Options $ MYSQL_HOME/my. for cnf server-related options defaults-extra-file, use the file specified by -- defaults-extra-file = path ~ /. My. cnf www.2cto.com
User-related option note: MYSQL_HOME is an environment variable that contains the directory path where the my. cnf file related to the server resides. If MYSQL_HOME is not set, and there is a my. cnf file in DATADIR, there is no my. cnf file in BASEDIR, and mysqld_safe sets MYSQL_HOME to DATADIR. If MYSQL_HOME is not set and my. cnf is not in DATADIR, mysqld_safe sets MYSQL_HOME to BASEDIR. MySQL searches for the configuration file in the above Order and reads the existing configuration file. If multiple configuration files exist, the option specified in the file to be read first takes precedence over the option specified in the file. The syntax of the option specified in the configuration file is similar to the command line syntax, except that two dashes are ignored. For example, -- quick or -- host = localhost in the command line should be specified as quick or host = localhost in the option file. [Group]: group is the program name or group name you want to set options. After a group row, any opt_name or set-variable row applies to the group name until the end of the Option file or other group rows are given.
Opt_name: equivalent to -- opt_name in the command line. Opt_name = value: equivalent to -- opt_name = value in the command line. In the option file, there can be spaces near the '=' character, but it is not allowed in the command line. You can use single or double quotation marks to reference a value. If the option group name is the same as the program name, the options in the group are dedicated to this program. All client programs (but not mysqld) read the [client] consumer group. This allows you to specify options that apply to all clients. It can be used in the option file! Include command to include specific files and! Includedir to search for the specific directory of the Option file. For example, to include the file/home/mydir/myopt. cnf, you can use :! Include/home/me/myopt. cnf to search for the directory/home/mydir of all files ending with. cnf and read it as an option file, use :! Includedir/home/mydir www.2cto.com
For example, suppose you want to use some content in my. cnf, as shown below: [mysqld]! Include/home/mydir/myopt. cnf in this case, only the file myopt. cnf is processed for this server, and! The include command will be ignored by the customer application. However, if you use the following part: [mysqldump]! Includedir/home/mydir/my-dump-option only. the directory/home/mydir/my-dump-option at the end of cnf is not checked by the server or other client applications. Note: currently, it is found in the Linux operating system! The file name included in the includedir command must be extension. cnf. In Windows, this command also checks files with. ini extensions (including. cnf. Author xinhanggebuguake

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.