ITPub博客

首页 > 数据库 > MySQL > my.cnf文件关于组选项的总结

my.cnf文件关于组选项的总结

原创 MySQL 作者:lusklusklusk 时间:2018-11-23 19:58:29 0 删除 编辑

1、[server]和[mysqld]的区别,没有看到官方文档,个人感觉server指整台服务器,mysqld指实例,当一台服务器上多个实例使用同一个配置文件my.cnf时,[server]通用于所有实例,[mysqld_3306] [[mysqld_3307] [mysqld_3308]对应单独实例

2、mysqld从[mysqld]和[server]组中读取选项。 mysqld_safe从[mysqld],[server],[mysqld_safe]和[safe_mysqld]组中读取选项。 mysql.server从[mysqld]和[mysql.server]组中读取选项。

3、[client]组更通用,因为它被所有客户端程序读取,而[mysqldump]组只能由mysqldump读取

4、后面的选项会覆盖前面的选项,比如按[client],[mysqldump]的顺序放置选项组,则[mysqldump]选项会覆盖[client]选项




https://dev.mysql.com/doc/refman/5.7/en/option-files.html

[group]

group is the name of the program or group for which you want to set options. After a group line, any option-setting lines apply to the named group until the end of the option file or another group line is given. Option group names are not case-sensitive.

group是要为其设置选项的程序或组的名称。 在组行之后,任何选项设置行都将应用于命名组,直到选项文件的末尾或另一个组行为止。 选项组名称不区分大小写。


If an option group name is the same as a program name, options in the group apply specifically to that program. For example, the [mysqld] and [mysql] groups apply to the mysqld server and the mysql client program, respectively.

The [client] option group is read by all client programs provided in MySQL distributions (but not by mysqld). 

如果选项组名称与程序名称相同,则组中的选项将专门应用于该程序。 例如,[mysqld]和[mysql]组分别应用于mysqld服务器和mysql客户端程序。

[client]选项组由MySQL发行版中提供的所有客户端程序读取(但不是由mysqld提供)。


The [client] group enables you to specify options that apply to all clients. For example, [client] is the appropriate group to use to specify the password for connecting to the server. (But make sure that the option file is accessible only by yourself, so that other people cannot discover your password.) Be sure not to put an option in the [client] group unless it is recognized by all client programs that you use. Programs that do not understand the option quit after displaying an error message if you try to run them.

List more general option groups first and more specific groups later. For example, a [client] group is more general because it is read by all client programs, whereas a [mysqldump] group is read only by mysqldump. Options specified later override options specified earlier, so putting the option groups in the order [client], [mysqldump] enables mysqldump-specific options to override [client] options.

[client]组使您可以指定适用于所有客户端的选项。 例如,[client]是用于指定连接到服务器的密码的适当组。 (但请确保选项文件只能由您自己访问,以便其他人无法发现您的密码。)请确保不要在[client]组中添加选项,除非您使用的所有客户端程序都能识别它。 如果您尝试运行错误消息,则在显示错误消息后,不理解该选项的程序将退出。

首先列出更多通用选项组,稍后列出更具体的组。 例如,[client]组更通用,因为它被所有客户端程序读取,而[mysqldump]组只能由mysqldump读取。 稍后指定的选项会覆盖先前指定的选项,因此按[client],[mysqldump]的顺序放置选项组会启用特定于mysqldump的选项来覆盖[client]选项。


To create option groups to be read only by mysqld servers from specific MySQL release series, use groups with names of [mysqld-5.6], [mysqld-5.7], and so forth. The following group indicates that the sql_mode setting should be used only by MySQL servers with 5.7.x version numbers:

[mysqld-5.7]

sql_mode=TRADITIONAL

要创建仅由特定MySQL发行系列中的mysqld服务器读取的选项组,请使用名称为[mysqld-5.6],[mysqld-5.7]等的组。 以下组表示sql_mode设置应仅由具有5.7.x版本号的MySQL服务器使用:

[mysqld-5.7]

sql_mode=TRADITIONAL


Write the contents of an included option file like any other option file. That is, it should contain groups of options, each preceded by a [group] line that indicates the program to which the options apply.

像任何其他选项文件一样写入包含的选项文件的内容。 也就是说,它应该包含选项组,每个选项前面都有一个[group]行,表示选项适用的程序。



https://dev.mysql.com/doc/refman/5.7/en/server-options.html

mysqld reads options from the [mysqld] and [server] groups. mysqld_safe reads options from the [mysqld], [server], [mysqld_safe], and [safe_mysqld] groups. mysql.server reads options from the [mysqld] and [mysql.server] groups.

An embedded MySQL server usually reads options from the [server], [embedded], and [xxxxx_SERVER] groups, where xxxxx is the name of the application into which the server is embedded.

mysqld从[mysqld]和[server]组中读取选项。 mysqld_safe从[mysqld],[server],[mysqld_safe]和[safe_mysqld]组中读取选项。 mysql.server从[mysqld]和[mysql.server]组中读取选项。

嵌入式MySQL服务器通常从[server],[embedded]和[xxxxx_SERVER]组中读取选项,其中xxxxx是嵌入服务器的应用程序的名称。



https://dev.mysql.com/doc/refman/5.7/en/server-options.html#option_mysqld_defaults-group-suffix

Read not only the usual option groups, but also groups with the usual names and a suffix of str. For example, mysqld normally reads the [mysqld] group. If the --defaults-group-suffix=_other option is given, mysqld also reads the [mysqld_other] group.

不仅要读取常用选项组,还要读取通常名称和后缀str的组。 例如,mysqld通常读取[mysqld]组。 如果给出了--defaults-group-suffix = _other选项,mysqld也会读取[mysqld_other]组。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30126024/viewspace-2221484/,如需转载,请注明出处,否则将追究法律责任。

全部评论
Welcome to Lukes DB HOME。 Oracle 10g OCP、Oracle 11g OCM、Mysql OCP, 8年以上DBA工作经验,博客仅记录自己的一个学习过程,不代表完全准确,如有需要,欢迎转载。

注册时间:2015-02-02

  • 博文量
    398
  • 访问量
    620085