Most MySQL programs can read startup option files(sometimes called configuration files).

Option files provide a convenient way to specify commonly used option so that they need not be entered on the command line each time you run a program.

Note

A MySQL program started with the --no-defaults option reads no option files other than .mylogin.cnf.

A server started with the persisted_globals_load system variable disabled does not read mysqld-auto.cnf.

Many option files are plain text files, created usingg any text editor.The exceptions are:

  `The .mylogin.cnf file that contains login path option. This is an encrypted file created by the mysql_config_editor utility.

See Section 4.6.7, “mysql_config_editor — MySQL Configuration Utility”. A “login path” is an option group that permits only certain options:

host, user, password, port and socket.

Client programs specify which login path to read from .mylogin.cnf using the --login-path option.

To specify an alternative login path file name, set the MYSQL_TEST_LOGIN_FILE environment variable. This variable is used by the mysql-test-run.pl testing utility, but also is recognized by mysql_config_editor and by MySQL clients such as mysql, mysqladmin, and so forth.

  `The mysqld-auto.cnf file in the data directory. This JSON-format file contains persisted system variable settings. It is created by the server upon execution of SET PERSIST or PERSIST_ONLY statements. See Section 13.7.5.1, “SET Syntax for Variable Assignment”. Management of mysqld-auto.cnf should be left to the server and not performed manually.


MySQL looks for option files in the order described in the following discussion and reads any that exist.

If an option file you want to use does not exist, create it using the appropriate method, as just discussed.

在option文件中,语法和命令行中的相似,但是可以省略开头的two dashes并且每行输入一个option.

空行被忽略.

1. #comment, ;comment

评论以#或者;开头. # 可以在行中评论.

2. [group] group是要设置options的program or group的名字

在group line后,任何option-setting lines可以应用于之前命名的group知道option文件结尾或者另一个group line is given.

group names大小写不敏感.

3. opt_name

4. opt_name=value

在option文件中,你可以在=前后加空格,而在命令行中是不行的.

value可以使用单引号或者双引号括起来,比如value中有#符号.

----------首尾的空格自动删除-------

可以分别用转义符+缩写字母 代表:

\b -->backspace ; \t -->tab ; \n=newline;\r=carriage return,\\=backslash(\); \s=space.

a backslash not followed by a valid escape sequence character remain unchanged.

也就是说\后面只要不跟那些valid escape sequence charater比如s,n等,还表示自身\

option文件中escape sequence规则和sql statement中的稍有不同.

在后者,如果x 不是valid escape sequence 字符,\x=x而不是\x.

  iF an option group name is the same as a program name, options in the group apply specifically to that program.

如果option group名和程序名相同,group会自动应用于程序.比如[mysqld] ,[mysql] groups 分别apply to mysqld server and the mysql client程序.

  [client] option group is read by all client programs provided in MySQL distributions (but ont by 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.

Be sure not  to put an option in the [client] gourp 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.

  

不是说group后的option在下一个group name之前生效吗?

typical global option file:

typical user option file:

特定版本的MySQL,组名后缀"-版本号"

还可以通过!include 来包含其他目录的option文件

.!include /home/mydir/myopt.cnf

或者只指定路径:

!includedir /home/mydir

On Windows, this directive checks for files with the .ini or .cnf extension.

Using Option Files的更多相关文章

  1. MapReduce

    2016-12-21  16:53:49 mapred-default.xml mapreduce.input.fileinputformat.split.minsize 0 The minimum ...

  2. 如何使用yum 下载 一个 package ?如何使用 yum install package 但是保留 rpm 格式的 package ? 或者又 如何通过yum 中已经安装的package 导出它,即yum导出rpm?

    注意 RHEL5 和 RHEL6 的不同 How to use yum to download a package without installing it Solution Verified - ...

  3. Linux 命令学习笔记

    文件基本操作 ls ,rm , mv , ln   ls ls [option] [files]   不带参数时,列出当前工作目录的内容 $ls   列出指定目录的内容 ls dir1 或个别文件 l ...

  4. MYsql 数据库密码忘记(Linux)

    在Linux 上面装上了 Mysql 数据库,但是发现密码忘了,悲催,解决方法跟Window系统下一样的, 不管是哪个操作系统处理的思路是相同的,就是首先要把mysql的权限去掉,这样即使忘了密码,不 ...

  5. Ubuntu 12.04 安装MySQL

    本文地址:http://www.cnblogs.com/yhLinux/p/4012689.html 本文适合新手入门. 本文是对 Ubuntu 12.04 环境下安装 MySQL 的记录,通过这两天 ...

  6. mysql 5.7.17发布

    Mysql 5.7.17发布了,主要修复: Changes in MySQL 5.7.17 (2016-12-12, General Availability) Compilation Notes M ...

  7. 解压版MySQL安装说明

    一.复制my.ini到MySQL解压的目录 例如:E:\MySQL 二.修改my.ini第39~40行 basedir = "E:\\MySQL" datadir = " ...

  8. linux 下mysql的启动 、调试、排错

    Linux 下 MySQL 启动与关闭 说明 一.启动 1.1  MySQL 进程 可以用ps 命令查看进程: [root@rac2 ~]# ps -ef|grep mysql root     21 ...

  9. 解决: Can’t connect to local MySQL server through socket /var/lib/mysql/mysql.sock

    今天在搬瓦工上使用mysql 命令行,总报一个这样的错:Can't connect to local MySQL server through socket '/xxxxx/mysql.sock',一 ...

随机推荐

  1. IDEA——找不到或无法加载主类的一种暴力解决方法

    对于用maven构建的java项目,可以利用maven工具编译一下,大致上可以解决很多奇奇怪怪的问题. 具体操作如下: 首先找到项目所在的文件夹,以F:\project为例. 删除.idea文件. 在 ...

  2. 浅谈Windows用户帐户控制(User Account Control,UAC)

    Microsoft一个事实:大多数用户都用一个Administrator(管理员)帐户来登录Windows.利用这个帐户,用户几乎没有任何限制地访问重要的系统资源,因为该帐户被授予很高的权限.一旦用户 ...

  3. openwrt支持哪些c库?

    答: 至2019/3/22,支持两种,一种是glibc,另一种是musl-libc(openwrt默认使用musl-libc)

  4. upc组队赛1 流连人间的苏苏

    流连人间的苏苏 题目描述 苏苏在做红尘仙的任务时,发现坐落于风景秀丽.四季如春的昆明市的云南中医学院. 没过多久,苏苏就喜欢上了这个学校.以致于苏苏忘了回涂山的时间,现在她只剩下d天的时间待在云南中医 ...

  5. FJUT3568 中二病也要敲代码(线段树维护区间连续最值)题解

    题意:有一个环,有1~N编号,m次操作,将a位置的值改为b,问你这个环当前最小连续和多少(不能全取也不能不取) 思路:用线段树维护一个区间最值连续和.我们设出两个变量Lmin,Rmin,Mmin表示区 ...

  6. 【20K必备知识点】北上广Java开发月薪20K往上,该如何做,需要会写什么

    有人回答说这只能是大企业或者互联网企业工程师才能拿到.也许是的,小公司或者非互联网企业拿两万的不太可能是码农了,应该已经转管理.还有区域问题,这个不在我的考虑范围内,因为除了北上广深杭,其他地方也很难 ...

  7. java 之 基础加强(一)

    常用快捷键: alt + / 代码提示 ctrl + / 单行注释 取消注释 ctrl + shift +/ 多行注释(先选中内容) ctrl + shift +\ 取消注释(先选中内容) ctrl ...

  8. 简单数论总结1——gcd与lcm

    并不重要的前言 最近学习了一些数论知识,但是自己都不懂自己到底学了些什么qwq,在这里把知识一并总结起来. 也不是很难的gcd和lcm 显而易见的结论: 为什么呢? 根据唯一分解定理: a和b都可被分 ...

  9. ARM MOV PC加8

    缘由 今天在分析ARM伪指令ADR,书上说ADR通常会被一条ADD或SUB指令替代实现相同功能.我反汇编了一下确实如此会基于PC相对偏移的地址量读取到寄存器中,可是计算却发现对不上 如上图所示,ADR ...

  10. EFI环境下的Ubuntu&Win10双系统安装

    因为是win10是EFI启动的,所以网上的easyBCD方法就不可以用了,这里用到的不是ultraiso软碟通,用的哪个忘了 不过只要能写入U盘做成启动盘就ok 具体参考的是https://blog. ...