`
icbm
  • 浏览: 58608 次
社区版块
存档分类
最新评论

mysql常用选项

 
阅读更多
binlog-format可以取值: STATEMENT (default),ROW,MIXED。必须有SUPER才可以更改。不推荐replication正在进行时,修改binlog-format值。

binlog-do-dbbinlog-ignore-dbreplicate-do-dbreplicate-ignore-db)对于多个数据库,必须用多行。因为数据库名字可以包含逗号,所以用逗号分隔多个数据库名字,会被认为是一个包含了逗号的数据库的名字。
无论binlog-format是什么,象create table和alter table之类的语句,总是以statement的格式记录在二进制日志中的。

binlog-do-db(binlog-ignore-db、replicate-do-db、replicate-ignore-db)生效与binlog-format有关:
binlog-format为STATEMENT时,生效的数据库为default database。
binlog-format为ROW时,生效的为表的所在的数据,与default database无关。

log-slave-updates 是否记录复制的更新。当用于级联复制时,很有必要。而在双主模式中,应当取FALSE。

auto_increment_increment
auto_increment_offset
取值为: auto_increment_offset + N*auto_increment_increment

sync-binlog 取值为0时,由操作系统的文件系统决定何时同步二进制日志。大于0时,为N个commit group后,同步到二进制日志。取值为1,最安全,但性能较低。

slave-ignore-errors 忽略复制的错误。不建议取值为all。正常情况下,不应该会有错;如果出错,应当解决错误,而不是忽略错误。

log-error 日志记录文件,记录MySQL服务器启动、关闭等信息。Windows平台注意路径要用“/”分隔,而不是“\”。

log-output (522页)
日志的记录位置:FILE TABLE NONE

sync_binlog (default 0, page 1849)

If the value of this variable is greater than 0, the MySQL server synchronizes its binary log to disk (using
fdatasync()) after sync_binlog[2129]commit groups are written to the binary log. The default
value of sync_binlog[2129]is 0, which does no synchronizing to disk—in this case, the server relies
on the operating system to flush the binary log's contents from to time as for any other file. A value of 1
is the safest choice because in the event of a crash you lose at most one commit group from the binary
log. However, it is also the slowest choice (unless the disk has a battery-backed cache, which makes
synchronization very fast).



innodb_flush_log_at_timeout (default 1, page 1810)

Write and flush the logs every Nseconds. This setting has an effect only when
innodb_flush_log_at_trx_commit[1811]has a value of 2.

innodb_flush_log_at_trx_commit (default 1, page 1811)
Controls the balance between strict ACIDcompliance for commitoperations, and higher performance
that is possible when commit-related I/O operations are rearranged and done in batches. You can
achieve better performance by changing the default value, but then you can lose up to one second worth
of transactionsin a crash.
• The default value of 1 is required for full ACID compliance. With this value, the log bufferis written out
to the log fileat each transaction commit and the flushto disk operation is performed on the log file.
• With a value of 0, any mysqldprocess crash can erase the last second of transactions. The log buffer
is written out to the log file once per second and the flush to disk operation is performed on the log file,
but no writes are done at a transaction commit.
• With a value of 2, only an operating system crash or a power outage can erase the last second of
transactions. The log buffer is written out to the file at each commit, but the flush to disk operation
is not performed on it. Before MySQL 5.6.6, the flushing on the log file takes place once per
second. Note that the once-per-second flushing is not 100% guaranteed to happen every second,
due to process scheduling issues. As of MySQL 5.6.6, flushing frequency is is controlled by
innodb_flush_log_at_timeout[1810]instead.
• InnoDB's crash recoveryworks regardless of the value. Transactions are either applied entirely or
erased entirely.
For the greatest possible durability and consistency in a replication setup using InnoDBwith
transactions, use innodb_flush_log_at_trx_commit=1and sync_binlog=1in your master
server my.cnffile.


thread_cache_size (default 8 + (max_connections / 100), page 580)

How many threads the server should cache for reuse. When a client disconnects, the client's threads
are put in the cache if there are fewer than thread_cache_size[580]threads there. Requests
for threads are satisfied by reusing threads taken from the cache if possible, and only when the cache
is empty is a new thread created. This variable can be increased to improve performance if you
have a lot of new connections. Normally, this does not provide a notable performance improvement
if you have a good thread implementation. However, if your server sees hundreds of connections
per second you should normally set thread_cache_size[580]high enough so that most new
connections use cached threads. By examining the difference between the Connections[618]and
Threads_created[632]status variables, you can see how efficient the thread cache is. For details,
see Section 5.1.6, “Server Status Variables”.
The default value is based on the following formula, capped to a limit of 100:
8 + (max_connections / 100)
分享到:
评论

相关推荐

    Linux下mysql常用操作

    mysql常用操作注意:MySQL中每个命令后都要以分号;结尾。

    mysql的选项文件my.ini|my.ini

    mysql的选项文件my.ini,常用内容已写好,并且保存的是ansi格式,满足使用需要,在凑字数.

    MYSQL常用命令大全

    MYSQL常用命令 1.导出整个数据库 mysqldump -u 用户名 -p --default-character-set=latin1 数据库名 > 导出的文件名(数据库默认编码是latin1) mysqldump -u wcnc -p smgp_apps_wcnc > wcnc.sql 2.导出一个表 ...

    MySql 5.1 参考手册.chm

    5.2.3. MySQL实例管理器命令行选项 5.2.4. MySQL实例管理器配置文件 5.2.5. MySQL实例管理器识别的命令 5.3. mysqld:MySQL服务器 5.3.1. mysqld命令行选项 5.3.2. SQL服务器模式 5.3.3. 服务器系统变量 5.3.4. ...

    MYSQL

    8 MySQL 教程 8.1 联接和断开服务器 8.2 输入查询 8.3 常用查询的例子 8.3.1 列的最大值 8.3.2 拥有某个列的最大值的行 8.3.3 列的最大值:按组:只有值 8.3.4 拥有某个字段的组间...

    MySQL中文参考手册.chm

    8 MySQL 教程 8.1 联接和断开服务器 8.2 输入查询 8.3 常用查询的例子 8.3.1 列的最大值 8.3.2 拥有某个列的最大值的行 8.3.3 列的最大值:按组:只有值 8.3.4 拥有某个字段的...

    MySQL 5.1参考手册

    5.2.3. MySQL实例管理器命令行选项 5.2.4. MySQL实例管理器配置文件 5.2.5. MySQL实例管理器识别的命令 5.3. mysqld:MySQL服务器 5.3.1. mysqld命令行选项 5.3.2. SQL服务器模式 5.3.3. 服务器系统变量 5.3.4...

    MySQL 5.1中文手冊

    5.2.3. MySQL实例管理器命令行选项 5.2.4. MySQL实例管理器配置文件 5.2.5. MySQL实例管理器识别的命令 5.3. mysqld:MySQL服务器 5.3.1. mysqld命令行选项 5.3.2. SQL服务器模式 5.3.3. 服务器系统变量 5.3.4. ...

    MySQL 5.1官方简体中文参考手册

    5.2.3. MySQL实例管理器命令行选项 5.2.4. MySQL实例管理器配置文件 5.2.5. MySQL实例管理器识别的命令 5.3. mysqld:MySQL服务器 5.3.1. mysqld命令行选项 http://doc.mysql.cn/mysql5/refman-5.1-zh.html-chapter/...

    MySQL5.1中文参考手册 CHM

    3.6. 常用查询的例子 3.6.1. 列的最大值 3.6.2. 拥有某个列的最大值的行 3.6.3. 列的最大值:按组 3.6.4. 拥有某个字段的组间最大值的行 3.6.5. 使用用户变量 3.6.6. 使用外键 3.6.7. 根据两个键搜索 3.6.8. 根据天...

    mysql5.1中文手册

    MySQL实例管理器命令行选项 5.2.4. MySQL实例管理器配置文件 5.2.5. MySQL实例管理器识别的命令 5.3. mysqld:MySQL服务器 5.3.1. mysqld命令行选项 5.3.2. SQL服务器模式 5.3.3. 服务器系统变量...

    MySQL 5.1参考手册中文版

    5.2.3. MySQL实例管理器命令行选项 5.2.4. MySQL实例管理器配置文件 5.2.5. MySQL实例管理器识别的命令 5.3. mysqld:MySQL服务器 5.3.1. mysqld命令行选项 5.3.2. SQL服务器模式 5.3.3. 服务器系统变量 5.3.4...

    MySQL 5.1参考手册 (中文版)

    5.2.3. MySQL实例管理器命令行选项 5.2.4. MySQL实例管理器配置文件 5.2.5. MySQL实例管理器识别的命令 5.3. mysqld:MySQL服务器 5.3.1. mysqld命令行选项 5.3.2. SQL服务器模式 5.3.3. 服务器系统变量 5.3.4. ...

    MySQL中文参考手册

    * 1 MySQL的一般的信息 o 1.1 什么是MySQL? o 1.2 关于本手册 + 1.2.1 本手册中使用的约定 o 1.3 MySQL的历史 o 1.4 MySQL的主要特征 o 1.5 MySQL稳定性? o 1.6 顺应2000年 o 1.7 SQL一般信息和教程 o ...

    MYSQL中文手册

    5.2.3. MySQL实例管理器命令行选项 5.2.4. MySQL实例管理器配置文件 5.2.5. MySQL实例管理器识别的命令 5.3. mysqld:MySQL服务器 5.3.1. mysqld命令行选项 5.3.2. SQL服务器模式 5.3.3. 服务器系统变量 ...

    mysql官方中文参考手册

    5.2.3. MySQL实例管理器命令行选项 5.2.4. MySQL实例管理器配置文件 5.2.5. MySQL实例管理器识别的命令 5.3. mysqld:MySQL服务器 5.3.1. mysqld命令行选项 5.3.2. SQL服务器模式 5.3.3. 服务器系统变量 5.3.4. ...

    mysql常用配置

    mysql配置(部分常用的参数)  [mysqld]  socket = /tmp/mysql.sock  # 为MySQL客户程序与服务器之间的本地通信指定一个套接字文件(Linux下默认是/var/lib/mysql/mysql.sock文件)  port = 3306  # 指定...

Global site tag (gtag.js) - Google Analytics