my.cnf檔案關於組選項的總結

lusklusklusk發表於2018-11-23

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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章