MySQL - Show Variables 整理

原文来源:MySQL 5.5 Reference Manual

部分翻译取自:《MySQL_5.1中文参考手册》

转载请注明原文链接http://www.cnblogs.com/lenagt/archive/2012/06/06/2538227.html 谢谢。

------------------------------------------------------------------------------------------

Show variables

在Show variables输出中的项: 5.1手册中没有的或者翻译有问题的,都附带5.5原文说明:

auto_increment_increment & auto_increment_offset

auto_increment_increment和auto_increment_offset用于主服务器-主服务器(master-to-master)复制,并可以用来控制AUTO_INCREMENT列的操作。两个变量均可以设置为全局或局部变量,并且假定每个值都可以为1到65,535之间的整数值。将其中一个变量设置为0会使该变量为1。如果试图将这些变量设置为大于65,535或小于0的值,则会将该值设置为65,535。如果向将auto_increment_increment或auto_increment_offset设置为非整数值,则会给出错误,并且变量的实际值在这种情况下保持不变。

auto_increment_increment控制列中的值的增量值。

auto_increment_offset确定AUTO_INCREMENT列值的起点

如果auto_increment_offset的值大于auto_increment_increment的值,则auto_increment_offset的值被忽略。

如果其中一个或两个变量被更改了,然后更改插入到包含AUTO_INCREMENT列的表中的新行,结果可能看上去有问题,由于计算AUTO_INCREMENT系列值

时没有考虑列内已经存在的值,并且插入的下一个值是列内最小的值,大于AUTO_INCREMENT列内已有的最大值。换句话说,数值的计算方法为:

auto_increment_offset+ N * auto_increment_increment

autocommit

自动提交模式。

automatic_sp_privileges

When this variable has a value of 1 (the default), the server automatically grants the EXECUTE and ALTER ROUTINE privileges to the creator of a stored routine, if the user cannot already execute and alter or drop the routine. (The ALTER ROUTINE privilege is required to drop the routine.) The server also automatically drops those privileges from the creator when the routine is dropped. If automatic_sp_privileges is 0, the server does not automatically add or drop these privileges.

如果用户已经不能执行和修改或删除程序,当这个变量设置为1时,服务器将自动为存储过程的创建者授予execute和alter routime权限。(alter routime权限需要删除程序。)

当程序被丢弃时,服务器会自动移除存储过程创建者的授权。如果这个变量设置为0,服务器将不会自动添加或删除这些权限。

big_tables

如果设置为1,所有的临时表被存储在磁盘中,而不是存储在储存期中。这样会稍微慢些,但是对于需要一个大型临时表的SELECT操作,不会发生The table tbl_name is full错误。对于一个新连接,默认值为0(使用存储器内部临时表)。通常,您不必设置此变量,因为根据需要,存储器内部表会被自动转换为以磁盘为基础的表。

binlog_cache_size

在事务过程中容纳二进制日志SQL语句的缓存大小。

binlog_direct_non_transactional_updates

binlog_format

binlog的格式。

binlog_stmt_cache_size

bulk_insert_buffer_size

MyISAM uses a special tree-like cache to make bulk inserts faster for INSERT ... SELECT, INSERT ... VALUES(...), (...), ..., and LOAD DATA INFILE when adding data to nonempty tables. This variable limits the size of thecache tree in bytes per thread. Setting it to 0 disables this optimization. The default value is 8MB.

MySQL当插入记录到非空的表时,会使用一种特殊的高速缓存树作为批量插入(INSERT...SELECT和INSERT...VALUES(),()或者LOAD DATA INFILE)。这个变量限制每个线程中高速缓存树的大小是多少字节。0为禁用,默认值是8MB。

character_set_client

来自客户端的语句的字符集。

character_set_connection

用于没有字符集导入符的文字和数字-字符串转换。

character_set_database

默认数据库使用的字符集。当默认数据库更改时,服务器则设置该变量。如果没有默认数据库,变量的值同character_set_server。

character_set_filesystem

The file system character set. This option sets the character_set_filesystem system variable.

文件系统字符集。这个选项调用了character_set_filesystem变量

character_set_results

用于向客户端返回查询结果的字符集。

character_set_server

服务器的默认字符集。

collation_connection

连接字符集的校对规则。

collation_database

默认数据库使用的校对规则。当默认数据库改变时服务器则设置该变量。如果没有默认数据库,变量的值同collation_server。

collation_server

服务器的默认校对规则。

completion_type

事务结束类型:

如果该值为0(默认),COMMIT和ROLLBACK不受影响。

如果该值为1,COMMIT和ROLLBACK分别等同于COMMIT AND CHAIN和ROLLBACK AND CHAIN。(新事务用刚刚结束的事务相同的间隔等级立即启动)。

如果该值为2,COMMIT和ROLLBACK分别等同于COMM它RELEASE和ROLLBACK RELEASE。(事务终止后,服务器断开)。

concurrent_insert

如果为ON(默认值),MySQL允许INSERT和SELECT语句在中间没有空数据块的MyISAM表中并行运行。你可以用--safe或--skip-new启动mysqld关闭该选项。

该变量为整数,有3个值:

值描述

0   关

1   (默认)在没有空数据块的MyISAM表中启用并行插入

2   为所有MyISAM表启用并行插入。如果表有空记录或正被另一线程使用,新行将插入到表的最后。如果表未使用,MySQL将进行普通读锁定并将新行插入空记录。

connect_timeout

mysqld服务器用Bad handshake响应前等待连接包的秒数。

debug

debug_sync

default_storage_engine

Set the default storage engine (table type) for tables.

设置表的默认存储引擎(表类型)。

default_week_format

WEEK() 函数使用的默认模式。

delay_key_write

该选项只适用MyISAM表。它具有下述值可以影响CREATE TABLE语句使用的DELAY_KEY_WRITE表选项的处理。

选项    描述

OFF     DELAY_KEY_WRITE被忽略。

ON      MySQL在CREATE TABLE中用DELAY_KEY_WRITE选项。这是默认值。

ALL     用启用DELAY_KEY_WRITE选项创建表的相同方法对所有新打开表的进行处理。

如果启用了DELAY_KEY_WRITE,说明使用该项的表的键缓冲区在每次更新索引时不被清空,只有关闭表时才清空。遮掩盖可以大大加快键的写操作,但如果你使用该特性,你应用--myisam-recover选项启动服务器,为所有MyISAM表添加自动检查(例如,--myisam-recover=BACKUP,FORCE)。

请注意--external-locking不为使用延迟键写入的表提供索引破坏保护。

delayed_insert_limit

插入delayed_insert_limit 延迟行后,INSERT DELAYED 处理器线程检查是否有挂起的SELECT语句。如果有,在继续插入延迟的行之前,允许它们先执行。

delayed_insert_timeout

INSERT DELAYED处理器线程终止前应等待INSERT语句的时间。

delayed_queue_size

这是各个表中处理INSERT DELAYED语句时队列中行的数量限制。如果队列满了,执行INSERT DELAYED语句的客户端应等待直到队列内再有空间。

div_precision_increment

该变量说明用/操作符执行除操作的结果可增加的精确度的位数。默认值是4。最小和最大值分别为0和30。

engine_condition_pushdown

该变量适用于NDB。默认值为0(OFF):如果你执行类似查询SELECT * FROM t WHERE mycol = 42,其中mycol为没有索引的列,当满了的表扫描每个NDB节点时,执行该查询。每个节点使用WHERE条件将每一行发送给MySQL服务器。如果engine_condition_pushdown被设置为1(ON),该条件“pushed down”给存储引擎并发送给NDB节点。每个节点都执行扫描,并只向MySQL服务器发送回匹配条件的行。

event_scheduler

This variable indicates the status of the Event Scheduler; possible values are ON, OFF, and DISABLED, with the default being OFF.

这个变量表示事件调度器的状态。可能值为ON/OFF/DISABLED,默认是OFF。

expire_logs_days

二进制日志自动删除的天数。默认值为0,表示“没有自动删除”。启动时和二进制日志循环时可能删除。

flush

如果用--flush选项启动mysqld该值为ON。

flush_time

如果设为非零值,每隔flush_time秒则关闭所有表以释放硬盘资源并同步未清空的数据。我们建议只在Windows 9x或Me,或有最小资源的系统中使用该选项。

foreign_key_checks

外键约束检查。1为开启(默认。) 0为忽略。

ft_boolean_syntax

使用IN BOOLEAN MODE执行的布尔全文搜索支持的操作符系列。

general_log

是否开启全日志

general_log_file

全日志的文件名

group_concat_max_len

函数group_concat()允许的最大长度

identity

This variable is a synonym for the last_insert_id variable. It exists for compatibility with other database systems

与变量last_insert_id同义。存在意义是为了与其他数据库系统兼容。

init_connect

服务器为每个连接的客户端执行的字符串。字符串由一个或多个SQL语句组成。要想指定多个语句,用分号间隔开。例如,每个客户端开始时默认启用autocommit模式。没有全局服务器变量可以规定autocommit默认情况下应禁用,但可以用init_connect来获得相同的效果:

SET GLOBAL init_connect='SET AUTOCOMMIT=0';

还可以在命令行或选项文件中设置该变量。要想使用选项文件设置变量,应包括下述行:

[mysqld]

init_connect='SET AUTOCOMMIT=0'

请注意init_connect的内容并不为拥有SUPER权限的用户执行;实际是内容设置错误(包含错误查询,例如语法错误),这样使所有连接失败。不为SUPER用户执行,使SUPER用户可以打开连接并固定init_connect。

init_slave

该变量类似init_connect,但是每次SQL线程启动时从服务器应执行该字符串。该字符串的格式与init_connect变量相同。

innodb_adaptive_flushing

Specifies whether to dynamically adjust the rate of flushing dirty pages in the InnoDB buffer pool based on the workload. Adjusting the flush rate dynamically is intended to avoid bursts of I/O activity. This setting is enabled by default.

指定是否需要根据工作量动态调整InnoDB缓冲池中的脏页刷新比例。默认启用。

innodb_adaptive_hash_index

Whether InnoDB adaptive hash indexes are enabled or disabled. This variable is enabled by default. Use --skip-innodb_adaptive_hash_index at server startup to disable it.

Innodb的自适应哈希索引是否被启用。默认启用。使用--skip-innodb_adaptive_hash_index选项启动服务可以禁用该选项。

innodb_autoextend_increment

当自动扩展表空间被填满之时,为扩展而增加的尺寸(MB为单位)。默认值是8。这个选项可以在运行时作为全局系统变量而改变。

innodb_change_buffering

Whether InnoDB performs change buffering, an optimization that delays write operations to secondary indexes so that the I/O operations can be performed sequentially.

InnoDB是否执行变化的缓冲,优化延迟写操作的辅助索引使I/O操作可以按顺序执行。

innodb_commit_concurrency

The number of threads that can commit at the same time. A value of 0 (the default) permits any number of transactions to commit simultaneously.

可以在同时提交的线程数。默认是0,允许任意数量提交。

innodb_concurrency_tickets

The number of threads that can enter InnoDB concurrently is determined by the innodb_thread_concurrency variable.A thread is placed in a queue when it tries to enter InnoDB if the number of threads has already reached the concurrency limit.When a thread is permitted to enter InnoDB, it is given a number of “free tickets” equal to the value of innodb_concurrency_tickets, and the thread can enter and leave InnoDB freely until it has used up its tickets. After that point, the thread again becomes subject to the concurrency check (and possible queuing) the next time it tries to enter InnoDB.

The default value is 500.

InnoDB并发线程数量取决于innodb_thread_concurrency变量。当它视图进入InnoDB时,线程数已经达到并发上限,这个线程会被放置在队列中。当这个线程被允许进入InnoDB时,获得一个免费门票,可以在使用之前都可以自由进入和离开InnoDB。之后线程再次被并发检查约束(和可能的排队),直到下一次试图进入InnoDB.

默认值为500.

innodb_fast_shutdown

如果你把这个参数设置为0,InnoDB在关闭之前做一个完全净化和一个插入缓冲合并。这些操作要花几分钟时间,设置在极端情况下要几个小时。如果你设置这个参数为1,InnoDB在关闭之时跳过这些操作。默认值为1。如果你设置这个值为2 (在Netware无此值), InnoDB将刷新它的日志然后冷关机,仿佛MySQL崩溃一样。已提交的事务不会被丢失,但在下一次启动之时会做一个崩溃恢复。

innodb_file_format

The file format to use for new InnoDB tables.

使用新的InnoDB表文件格式。

innodb_file_format_max

At server startup, InnoDB sets the value of innodb_file_format_max to the file format tag in the shared tablespace. If the server creates or opens a table with a “higher” file format, it sets the value of innodb_file_format_max to that format.

在服务器启动时,InnoDB使用共享表空间中文件格式来标记innodb_file_format_max的值

如果服务器用“更高级别”的文件格式打开或创建一个表,则使用innodb_file_format_max的值来作为格式。

innodb_file_per_table

这个选项致使InnoDB用自己的.ibd文件为存储数据和索引创建每一个新表,而不是在共享表空间中创建。

innodb_flush_log_at_trx_commit

当innodb_flush_log_at_trx_commit被设置为0,日志缓冲每秒一次地被写到日志文件,并且对日志文件做到磁盘操作的刷新,但是在一个事务提交不做任何操作。当这个值为1(默认值)之时,在每个事务提交时,日志缓冲被写到日志文件,对日志文件做到磁盘操作的刷新。当设置为2之时,在每个提交,日志缓冲被写到文件,但不对日志文件做到磁盘操作的刷新。尽管如此,在对日志文件的刷新在值为2的情况也每秒发生一次。我们必须注意到,因为进程安排问题,每秒一次的刷新不是100%保证每秒都发生。你可以通过设置这个值不为1来获得较好的性能,但随之你会在一次崩溃中损失二分之一价值的事务。如果你设置这个值为0,那么任何mysqld进程的崩溃会删除崩溃前最后一秒的事务,如果你设置这个值为2,那么只有操作系统崩溃或掉电才会删除最后一秒的事务。尽管如此,InnoDB的崩溃恢复不受影响,而且因为这样崩溃恢复开始作用而不考虑这个值。注意,许多操作系统和一些磁盘硬件会欺骗刷新到磁盘操作。尽管刷新没有进行,你可以告诉mysqld刷新已经进行。即使设置这个值为1,事务的持久程度不被保证,且在最坏情况下掉电甚至会破坏InnoDB数据库。在SCSI磁盘控制器中,或在磁盘自身中,使用有后备电池的磁盘缓存会加速文件刷新并且使得操作更安全。你也可以试着使用Unix命令hdparm来在硬件缓存中禁止磁盘写缓存,或使用其它一些对硬件提供商专用的命令。这个选项的默认值是1。

innodb_io_capacity

An upper limit on the I/O activity performed by the InnoDB background tasks,such as flushing pages from the buffer pool and merging data from the insert buffer. The default value is 200.

InnoDB后台任务执行I/O活动的上限,例如从缓冲池刷新页面、从插入缓冲区合并页面等。默认值为200.

innodb_large_prefix

Enable this option to allow index key prefixes longer than 767 bytes (up to 3072 bytes), for InnoDB tables that use the DYNAMIC and COMPRESSED row formats.

启用此选项可以允许超过767字节的前缀索引(最多3072字节),当InnoDB表使用动态或压缩行格式时。

innodb_lock_wait_timeout

InnoDB事务在被回滚之前可以等待一个锁定的超时秒数。InnoDB在它自己的锁定表中自动检测事务死锁并且回滚事务。InnoDB用LOCK TABLES语句注意到锁定设置。默认值是50秒。

为在一个复制建立中最大可能的持久程度和连贯性,你应该在主服务器上的my.cnf文件里使用innodb_flush_log_at_trx_commit=1和sync-binlog=1。

innodb_max_dirty_pages_pct

这是一个范围从0到100的整数。默认是90。InnoDB中的主线程试着从缓冲池写页面,使得脏页(没有被写的页面)的百分比不超过这个值。如果你有SUPER权限,这个百分比可以在服务器运行时按下面来改变:

SET GLOBAL innodb_max_dirty_pages_pct = value;

innodb_max_purge_lag

这个选项控制在净化操作被滞后之时,如何延迟INSERT, UPDATE和DELETE操作。这个参数的默认值是零,意为无延迟。这个选项可以在运行时作为全局系统变量而被改变。InnoDB事务系统维持一个事务列表,该列表有被UPDATE或DELETE操作标志为删除的索引记录。让这个列表的长度为purge_lag。当purge_lag超过innodb_max_purge_lag之时,每个INSERT, UPDATE和DELETE操作延迟 ((purge_lag/innodb_max_purge_lag)*10)-5毫秒。在净化批处理的开始,延迟每隔10秒计算。如果因为一个旧的可以看到行被净化的一致的读查看, 删除操作不被延迟。

对有问题的工作量,典型设置可能是1百万,假设我们的事务很小,只有100字节大小,我们就可以允许在我们的表之中有100MB未净化的行。

innodb_old_blocks_pct

Specifies the approximate percentage of the InnoDB buffer pool used for the old  block sublist. The range of values is 5 to 95.The default value is 37 (that is, 3/8 of the pool).

指定InnoDB缓冲池使用旧的块子表的近似百分比,范围是5到95,默认是37(3/8的缓冲池)。

innodb_old_blocks_time

Specifies how long in milliseconds (ms) a block inserted into the old sublist must stay there after its first access before it can be moved to the new sublist. The default value is 0:

指定一个块从插入到旧子表到它可以被移动到新的子表之前必须留在这里的时间(毫秒)。默认值为0.

innodb_read_ahead_threshold

Controls the sensitivity of linear read-ahead that InnoDB uses to prefetch pages into the buffer cache.

控制灵敏度线性预读,InnoDB使用预读入告诉缓存区的页面。

innodb_replication_delay

The replication thread delay (in ms) on a slave server if innodb_thread_concurrency is reached.

复制线程由于innodb_thread_concurrency达到界限在从机延迟的时间(豪秒)。

innodb_rollback_segments

Defines how many of the rollback segments in the system tablespace that InnoDB uses within a transaction. You might reduce this value from its default of 128 if a smaller number of rollback segments performs better for your workload.

定义InnoDB的一个事务中,在系统表空间中可以使用多少回滚段。默认值为128.

innodb_spin_wait_delay

The maximum delay between polls for a spin lock. The default value is 6.

旋转锁之间轮询的最大延迟。默认值是6.

innodb_stats_method

How the server treats NULL values when collecting statistics about the distribution of index values for InnoDB tables.

当服务器收集统计有关InnoDB表的索引值分布时,如何处理NULL值。

innodb_stats_on_metadata

当启用此变量,InnoDB会在执行元数据语句(类似 SHOW TABLE STATUS 或SHOW INDEX ,或访问INFORMATION_SCHEMA)时更新统计信息。

innodb_stats_sample_pages

The number of index pages to sample for index distribution statistics such as are calculated by ANALYZE TABLE. The default value is 8.

索引页在索引分布统计中的样本数量。类似对于ANALYE TABLE的计算。 默认值为8。

innodb_strict_mode

Whether InnoDB returns errors rather than warnings for certain conditions. This is analogous to strict SQL mode.The default value is OFF.

InnoDB是否返回错误而不是警告。这类似严格的SQL模式。默认关闭。

innodb_support_xa

当被设置为ON或者1(默认地),这个变量允许InnoDB支持在XA事务中的双向提交。允许innodb_support_xa导致一个额外的对事务准备的磁盘刷新。如果你对使用XA并不关心,你可以通过设置这个选项为OFF或0来禁止这个变量,以减少磁盘刷新的次数并获得更好的InnoDB性能。

innodb_sync_spin_loops

The number of times a thread waits for an InnoDB mutex to be freed before the thread is suspended. The default value is 30.

线程被挂起之前,等待InnoDB互斥锁被释放的时间。默认值为30.

innodb_table_locks

InnoDB重视LOCK TABLES,直到所有其它线程已经释放他们所有对表的锁定,MySQL才从LOCK TABLE ..WRITE返回。默认值是1,这意为LOCK TABLES让InnoDB内部锁定一个表。在使用AUTOCOMMIT=1的应用里,InnoDB的内部表锁定会导致死锁。你可以在my.cnf文件(Windows上是my.ini文件)里设置innodb_table_locks=0 来消除这个问题。

innodb_thread_concurrency

InnoDB试着在InnoDB内保持操作系统线程的数量少于或等于这个参数给出的限制。如果有性能问题,并且SHOW INNODB STATUS显示许多线程在等待信号,可以让线程“thrashing” ,并且设置这个参数更小或更大。如果你的计算机有多个处理器和磁盘,你可以试着这个值更大以更好地利用计算机的资源。一个推荐的值是系统上处理器和磁盘的个数之和。值为500或比500大会禁止调用并发检查。默认值是20,并且如果设置大于或等于20,并发检查将被禁止。

innodb_thread_sleep_delay

How long InnoDB threads sleep before joining the InnoDB queue, in microseconds. The default value is 10,000. A value of 0 disables sleep.

InnoDB线程在加入InnoDB队列之前睡眠时间(微秒)。默认值为10000,值为0时禁止。

insert_id

当插入一个AUTO_INCREMENT值的时候这个变量被用在INSERT或ALTER TABLE语句后面。主要用在全日志。

interactive_timeout

服务器关闭交互式连接前等待活动的秒数。

join_buffer_size

用于完全联接的缓冲区的大小(当不使用索引的时候使用联接操作)。一般情况获得快速联接的最好方法是添加索引。当增加索引时不可能通过增加join_buffer_size值来获得快速完全联接。将为两个表之间的每个完全联接分配联接缓冲区。对于多个表之间不使用索引的复杂联接,需要多联接缓冲区。

keep_files_on_create

If a MyISAM table is created with no DATA DIRECTORY option, the .MYD file is created in the database directory. By default, if MyISAM finds an existing .MYD file in this case, it overwrites it. The same applies to .MYI files for tables created with no

INDEX DIRECTORY option. To suppress this behavior, set the keep_files_on_create variable to ON (1), in which case MyISAM will not overwrite existing files and returns an error instead. The default value is OFF (0).

如果在没有数据目录选项时创建一个MyISAM表,.MYD文件将在数据库目录中创建。 默认情况下,值为0,如果MyISAM发现存在.MYD文件,则会进行覆盖。.MYI文件对于索引目录选项也是如此。如果设置值为1,MyISAM表不会覆盖并产生一个错误。

key_buffer_size

MyISAM表的索引块分配了缓冲区,由所有线程共享。key_buffer_size是索引块缓冲区的大小。键值缓冲区即为键值缓存。

key_buffer_size的最大允许设定值为4GB。有效最大值可以更小,取决于可用物理RAM和操作系统或硬件平台强加的每个进程的RAM限制。

增加该值,达到你可以提供的更好的索引处理(所有读和多个写操作)。通常为主要运行MySQL的机器内存的25%。但是,如果你将该值设得过大(例如,大于总内存的50%),系统将转换为页并变得极慢。MySQL依赖操作系统来执行数据读取时的文件系统缓存,因此你必须为文件系统缓存留一些空间。

同时写多行时要想速度更快,应使用LOCK TABLES

key_cache_age_threshold

该值控制将缓冲区从键值缓存热子链(sub-chain)降级到温子链(sub-chain)。如果值更低,则降级更快。最小值为100。默认值是300。

key_cache_block_size

键值缓存内块的字节大小。默认值是1024。

key_cache_division_limit

键值缓存缓冲区链热子链和温子链的划分点。该值为缓冲区链用于温子链的百分比。允许的值的范围为1到100。默认值是100。

last_insert_id

返回LAST_INSERT_ID()的值。

lc_messages

使用错误信息的语言环境。

lc_time_names

控制使用的语言来显示日期月份的名称和缩写。

local_infile

是否支持LOAD DATA INFILE语句。

lock_wait_timeout

This variable specifies the timeout in seconds for attempts to acquire metadata locks. The permissible values range from 1 to 31536000 (1 year). The default is 31536000.

这个变量指定获取元数据锁的超时时间。允许值的范围从1到3153600(默认)。

log

是否启用将所有查询记录到常规查询日志中。

log_bin_trust_function_creators

This variable applies when binary logging is enabled. It controls whether stored function creators can be trusted not to create stored functions that will cause unsafe events to be written to the binary log. If set to 0 (the default), users are not permitted to create or alter stored functions unless they have the SUPER privilege in addition to the CREATE ROUTINE or ALTER ROUTINE privilege.

这个变量仅当启用二进制日志时适用。它控制存储功能的创建者是否可以信任,而不是制造存储功能。这将导致不安全的事件被写入到二进制日志。如果设置为0(默认),用户不得创建或更改存储功能,除非有SUPER或CREATE ROUTINE 或ALTER ROUTINE权限。

log_bin_trust_routine_creators

若启用了二进制记录,则该变量适用。它控制是否可以信任保存的程序的作者不会创建向二进制日志写入不安全事件的程序。如果设置为0(默认情况),不允许用户创建或修改保存的程序,除非他们不仅拥有CREATE ROUTINE或ALTER ROUTINE权限还拥有SUPER权限。

 

log_output

全日志和慢查询日志的输出位置。

log_queries_not_using_indexes

未使用索引的查询是否记录进慢查询日志。

log_slow_queries

是否记录慢查询。

log_warnings

是否产生其它警告消息。默认情况下启用。放弃的连接不记入错误日志,除非值大于1。

long_query_time

如果查询时间超过该值,则增加Slow_queries状态变量。如果你正使用--log-slow-queries选项,则查询记入慢查询日志文件。用实际时间测量该值,而不是CPU时间,因此低于轻负载系统阈值的查询可能超过重负载系统的阈值。

low_priority_updates

如果设置为1,所有INSERT、UPDATE、DELETE和LOCK TABLE WRITE语句将等待直到受影响的表没有挂起的SELECT或LOCK TABLE READ。该变量以前叫做sql_low_priority_updates。

max_allowed_packet

包或任何生成/中间 字符串的最大大小。

包消息缓冲区初始化为net_buffer_length字节,但需要时可以增长到max_allowed_packet字节。该值默认很小,以捕获大的(可能是错误的)数据包。

如果你使用大的BLOB 列或长字符串,你必须增加该值。应同你想要使用的最大的BLOB一样大。max_allowed_packet的协议限制为1GB。

max_binlog_cache_size

如果多语句事务需要更大的内存,你会得到错误Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage。

max_binlog_size

如果二进制日志写入的内容超出给定值,日志就会发生滚动。你不能将该变量设置为大于1GB或小于4096字节。默认值是1GB。

请注意如果你正使用事务:事务以一个块写入二进制日志,因此不不能被几个二进制日志拆分。因此,如果你有大的事务,二进制日志可能会大于max_binlog_size。

max_binlog_stmt_cache_size

If nontransaction statements within a transaction require more than this many bytes of memory, the server generates an error.

The minimum value is 4096. The maximum and default values are 4GB on 32-bit platforms and 16PB (petabytes) on 64-bit platforms.

如果事务中非事务语句在内存中超过多少字节,服务器会产生一个错误。最小值是4096。32位操作系统最大值为4GB,64位为16PB。

max_connect_errors

如果中断的与主机的连接超过该数目,该主机则阻塞后面的连接。你可以用FLUSH HOSTS语句解锁锁定的主机。

max_connections

允许的并行客户端连接数目。增大该值则增加mysqld 需要的文件描述符的数量。

max_delayed_threads

不要启动大于该数目的线程来处理INSERT DELAYED语句。如果所有INSERT DELAYED线程已经在使用,你想在新表中插入数据,行插入时好像未指定DELAYED属性。如果你将该值设置为0,MySQL不会创建线程来处理DELAYED行;其结果是完全禁用了DELAYED。

max_error_count

保存由SHOW ERRORS或SHOW WARNINGS显示的错误、警告和注解的最大数目。

max_heap_table_size

该变量设置MEMORY (HEAP)表可以增长到的最大空间大小。该变量用来计算MEMORY表的MAX_ROWS值。在已有的MEMORY表上设置该变量没有效果,除非用CREATE TABLE或TRUNCATE TABLE等语句重新创建表。

max_insert_delayed_threads

该变量为max_delayed_threads的同义词。

max_join_size

不允许可能需要检查多于max_join_size行(为单个表语句)或行组合(为多个表语句)或可能执行大于max_join_size次硬盘查询的SELECT语句。通过设置该值,你可以捕获键使用不正确并可能花很长时间的SELECT语句。如果用户想要执行没有WHERE子句的花较长时间或返回数百万行的联接,则设置它。

max_length_for_sort_data

确定使用的filesort算法的索引值大小的限值。

max_prepared_stmt_count

变量限定了服务器预处理语句的总数。

max_relay_log_size

如果复制从服务器写入中继日志时超出给定值,则滚动中继日志。通过该变量你可以对中继日志和二进制日志设置不同的限制。但是,将该变量设置为0,MySQL可以对二进制日志和中继日志使用max_binlog_size。max_relay_log_size必须设置在4096字节和1GB(包括)之间,或为0。默认值是0。

max_seeks_for_key

限制根据键值寻找行时的最大搜索数。

max_sort_length

当排序BLOB或TEXT值时使用的字节数。

max_sp_recursion_depth

The number of times that any given stored procedure may be called recursively.

任何指定的存储过程可以递归调用的次数。

max_tmp_tables

客户端可以同时打开的临时表的最大数。(但该选项还未生效)。

max_user_connections

任何给定的MySQL账户允许的最大同时连接数。0值表示“没有限制”。

max_write_lock_count

超过写锁定限制后,允许部分读锁定。

min_examined_row_limit

查询检查少于这个行数的不写入慢查询日志。默认为0.

myisam_data_pointer_size

默认指针大小,单位是字节,当未指定MAX_ROWS选项时,CREATE TABLE使用该变量创建MyISAM表。该变量不能小于2或大于7。默认值是6。

myisam_max_sort_file_size

重建MyISAM索引(在REPAIR TABLE、ALTER TABLE或LOAD DATA INFILE过程中)时,允许MySQL使用的临时文件的最大空间大小。如果文件的大小超过该值,则使用键值缓存创建索引,要慢得多。该值的单位为字节。

myisam_repair_threads

如果该值大于1,在Repair by sorting过程中并行创建MyISAM表索引(每个索引在自己的线程内)。默认值是1。

myisam_sort_buffer_size

当在REPAIR TABLE或用CREATE INDEX创建索引或ALTER TABLE过程中排序MyISAM索引分配的缓冲区。

myisam_stats_method

当为MyISAM表搜集关于索引值分发的统计信息时服务器如何处理NULL值。

myisam_use_mmap

使用内存映射来读写MyISAM表。

NDB_xxx

ndb_autoincrement_prefetch_sz

ndb_blob_read_batch_bytes

ndb_blob_write_batch_bytes

ndb_cache_check_time

ndb_deferred_constraints

ndb_deferred_constraints

ndb_distribution={KEYHASH|LINHASH}

ndb_distribution

ndb_extra_logging

ndb_force_send

ndb_log_bin

ndb_log_binlog_index

ndb_log_empty_epochs

ndb_log_empty_epochs

ndb_log_update_as_write

ndb_log_updated_only

ndb_optimization_delay

ndb_table_no_logging

ndb_table_temporary

ndb_use_exact_count

ndb_use_transactions

ndbinfo_max_bytes

ndbinfo_max_rows

ndbinfo_show_hidden

ndbinfo_table_prefix

net_buffer_length

在查询之间将通信缓冲区重设为该值。一般情况不应改变,但如果内存很小,可以将它设置为期望的客户端发送的SQL语句的长度。如果语句超出该长度,缓冲区自动扩大,直到max_allowed_packet字节。

net_read_timeout

中断读前等待连接的其它数据的秒数。当服务器从客户端读数时,net_read_timeout指控制何时中断的超时值。当服务器向客户端写时,net_write_timeout指控制何时中断的超时值。又见slave_net_timeout。

net_retry_count

如果某个通信端口的读操作中断了,在放弃前重试多次。在FreeBSD中该值应设得很高,因为内部中断将发送至所有线程。

net_write_timeout

中断写之前等待块写入连接的秒数。又见net_read_timeout。

new

在MySQL 4.0中使用该变量来打开4.1中的一些行为,并用于向后兼容性。

old_alter_table

When this option is given, the server does not use the optimized method of processing an ALTER TABLE operation.

这个选项启用时,服务器不使用optimized方法来运行ALTER TABLE语句。

old_passwords

是否服务器应为MySQL用户账户使用pre-4.1-style密码。

optimizer_prune_level

在查询优化从优化器搜索空间裁减低希望局部计划中使用的控制方法。

optimizer_search_depth

查询优化器进行的搜索的最大深度。

optimizer_switch

optimizer_switch系统变量支持控制优化行为。

preload_buffer_size

重载索引时分配的缓冲区大小。

profiling

是否开启profiling语句。默认为0(不开启)。

profiling_history_size

The number of statements for which to maintain profiling information if profiling is enabled. The default value is 15.

profiling信息记录保存的条数。默认为15。

pseudo_thread_id

This variable is for internal server use.

这个变量是服务器内部使用。

query_alloc_block_size

为查询分析和执行过程中创建的对象分配的内存块大小。如果内存分段过程中遇到问题,将该变量增加一位会有帮助。

query_cache_limit

不要缓存大于该值的结果。默认值是1048576(1MB)。

query_cache_min_res_unit

查询缓存分配的最小块的大小(字节)。默认值是4096(4KB)。

query_cache_size

为缓存查询结果分配的内存的数量。默认值是0,即禁用查询缓存。请注意即使query_cache_type设置为0也将分配此数量的内存。

query_cache_type

设置查询缓存类型。设置GLOBAL值可以设置后面的所有客户端连接的类型。客户端可以设置SESSION值以影响他们自己对查询缓存的使用。

选项            描述

0或OFF         不要缓存或查询结果。请注意这样不会取消分配的查询缓存区。要想取消,你应将query_cache_size设置为0。

1或ON          缓存除了以SELECT SQL_NO_CACHE开头的所有查询结果。

2或DEMAND 只缓存以SELECT SQL_NO_CACHE开头的查询结果。

该变量默认设为ON。

query_cache_wlock_invalidate

一般情况,当客户端对MyISAM表进行WRITE锁定时,如果查询结果位于查询缓存中,则其它客户端未被锁定,可以对该表进行查询。将该变量设置为1,则可以对表进行WRITE锁定,使查询缓存内所有对该表进行的查询变得非法。这样当锁定生效时,可以强制其它试图访问表的客户端来等待。

query_prealloc_size

用于查询分析和执行的固定缓冲区的大小。在查询之间该缓冲区不释放。如果你执行复杂查询,分配更大的query_prealloc_size值可以帮助提高性能,因为它可以降低查询过程中服务器分配内存的需求。

rand_seed1

rand_seed2

range_alloc_block_size

范围优化时分配的块的大小。

read_buffer_size

每个线程连续扫描时为扫描的每个表分配的缓冲区的大小(字节)。如果进行多次连续扫描,可能需要增加该值, 默认值为131072。

read_only

当变量对复制从服务器设置为ON时,从服务器不允许更新,除非通过从服务器的线程或用户拥有SUPER权限。可以确保从服务器不接受客户端的更新命令。

read_rnd_buffer_size

当排序后按排序后的顺序读取行时,则通过该缓冲区读取行,避免搜索硬盘。将该变量设置为较大的值可以大大改进ORDER BY的性能。但是,这是为每个客户端分配的缓冲区,因此你不应将全局变量设置为较大的值。相反,只为需要运行大查询的客户端更改会话变量。

relay_log_purge

当不再需要中继日志时禁用或启用自动清空中继日志。默认值是1(启用)。

relay_log_recovery

Enables automatic relay log recovery immediately following server startup, which means that the replication slave discards all unprocessed relay logs and retrieves them from the replication master.

启动服务时中继日志立刻恢复。这意味着从机丢弃所有未处理的终极日志并且从主机上重新检索它们。

rpl_recovery_rank

变量没有使用。在MySQL 5.6版本中被移除。

rpl_semi_sync_master_enabled

Controls whether semisynchronous replication is enabled on the master. To enable or disable the plugin, set this variable to ON or OFF (or 1 or 0), respectively. The default is OFF.

控制半同步复制是否在主机启用。默认是OFF。

rpl_semi_sync_master_timeout

A value in milliseconds that controls how long the master waits on a commit for acknowledgment from a slave before timing out and reverting to asynchronous replication. The default value is 10000 (10 seconds).

一个以毫秒为单位的变量。控制主机等待一个提交确认的超时和恢复异步复制的时间。默认为10000(10秒)。

rpl_semi_sync_master_trace_level

半同步复制的跟踪级别。

rpl_semi_sync_master_wait_no_slave

With semisynchronous replication, for each transaction, the master waits until timeout for acknowledgment of receipt from some semisynchronous slave. If no response occurs during this period, the master reverts to normal replication. This variable controls whether the master waits for the timeout to expire before reverting to normal replication even if the slave count drops to zero during the timeout period.

半同步复制中,对于每个事务,主机等待收到从机的确认,直到超时。

在此期间,如果没有响应时,主机恢复到正常复制。这个变量控制主机是否在等待超时期前恢复到正常的复制,即使从机计数在超时期间下降到0。

rpl_semi_sync_slave_enabled

Controls whether semisynchronous replication is enabled on the slave. To enable or disable the plugin, set this variable to ON or OFF (or 1 or 0), respectively. The default is OFF.

半同步复制是否在从机上启用。默认关闭。

rpl_semi_sync_slave_trace_level

The semisynchronous replication debug trace level on the slave. See rpl_semi_sync_master_trace_level for the permissible values.

半同步复制在从机上的跟踪级别。同rpl_semi_sync_master_trace_level类似。

safe_show_database

此选项已与MySQL 5.5.3版本被移除。

secure_auth

If this variable is enabled, the server blocks connections by clients that attempt to use accounts that have passwords stored in the old (pre-4.1) format.

如果启用此变量,服务器模块连接的客户端尝试使用老格式的旧密码账户。

server_id

--server-id选项的值。用于主复制服务器和从复制服务器。

slave_allow_batching

Whether or not batched updates are enabled on MySQL Cluster replication slaves.

是否在MySQL集群的从机上启用批量更新。

slave_compressed_protocol

Whether to use compression of the slave/master protocol if both the slave and the master support it.

主机和从机是否启用压缩的slave/master协议。

 

slave_exec_mode

Controls whether IDEMPOTENT or STRICT mode is used in replication conflict resolution and error checking.

控制是否在复制解决冲突和错误检查中开启IDEMPOTENT和STRICT模式。

slave_net_timeout

在从机认为连接打破之前向主机等待更多数据的秒数,中止读,并尝试重新连接。

slave_transaction_retries

如果由于ofInnoDB死锁或超过InnoDB的innodb_lock_wait_timeout或NDBCLUSTER的TransactionDeadlockDetectionTimeout或TransactionInactiveTimeout,复制从服务器SQL线程未能执行事务,在提示错误并停止前它自动重复slave_transaction_retries次。默认值是10。

slow_launch_time

如果创建线程的时间超过该秒数,服务器增加Slow_launch_threads状态变量。

slow_query_log

是否开启慢查询日志。

slow_query_log_file

指定慢查询日志文件的名字。

sort_buffer_size

每个排序线程分配的缓冲区的大小。增加该值可以加快ORDER BY或GROUP BY操作。

sql_auto_is_null

If this variable is set to 1, then after a statement that successfully inserts an automatically generated AUTO_INCREMENT value, you can find that value by issuing a statement of the following form:

SELECT * FROM tbl_name WHERE auto_col IS NULL

如果这个变量设置为1,当你成功的插入一个自动从生成的AUTO_INCREAMENT值,通过发出以下形式的语句,你可以找到该值。

sql_big_selects

If set to 0, MySQL aborts SELECT statements that are likely to take a very long time to execute (that is, statements for which the optimizer estimates that the number of examined rows exceeds the value of max_join_size). This is useful when an inadvisable WHERE statement has been issued. The default value for a new connection is 1, which permits all SELECT statements.

如果设置为0,MySQL会放弃可能需要执行很长时间的select语句。(即语句检查行数超过max_join_size)。默认为1,允许所有的select语句。

sql_big_tables

Enable large result sets by saving all temporary sets in files.

使用大型结果集保存所有临时集到文件中。

sql_buffer_result

If set to 1, sql_buffer_result forces results from SELECT statements to be put into temporary tables.

如果设置为1,sql_buffer_result强制将select语句的输出保存在临时表。

sql_log_bin

This variable controls whether logging to the binary log is done. The default value is 1 (do logging). To change logging for the current session, change the session value of this variable. The session user must have the SUPER privilege to set this variable.

这个变量控制执行的语句是否被记录到二进制日志。默认值是1(记录)。这个变量是session级别的,必须具有SUPER权限才可以使用。

sql_log_off

This variable controls whether logging to the general query log is done. The default value is 0 (do logging). To change logging for the current session, change the session value of this variable. The session user must have the SUPER privilege to set this option. The default value is 0.

这个变量控制全日志是否记录完成。默认值是0(记录)。这个变量是session级别的,必须具有SUPER权限才可以使用。

sql_log_update

这个变量被弃用。 映射到sql_log_bin 。从MySQL 5.5.3版本中移除。

sql_low_priority_updates

If set to 1, all INSERT, UPDATE, DELETE, and LOCK TABLE WRITE statements wait until there is no pending SELECT or LOCK TABLE READ on the affected table.

如果设置为1,所有的INSERT, UPDATE, DELETE,和LOCK TABLE WRITE语句等待,直到受影响的表中没有挂起的SELECT或LOCK TABLE READ。

sql_max_join_size

Do not permit SELECT statements that probably need to examine more than max_join_size rows (for single-table statements) or row combinations (for multiple-table statements) or that are likely to do more than max_join_size disk seeks.

不允许select语句检查超过max_join_size的行数。(包括单表查询和多表查询)

sql_mode

sql_notes

If set to 1 (the default), warnings of Note level increment warning_count and the server records them.

如果设置为1(默认),报警不会增加warning_count并且不会被服务器记录。

sql_quote_show_create

If set to 1 (the default), the server quotes identifiers for SHOW CREATE TABLE and SHOW CREATE DATABASE statements. If set to 0, quoting is disabled. This option is enabled by default so that replication works for identifiers that require quoting.

如果设置为1(默认),服务器为SHOW CREATE TABLE和SHOW CREATE DATABASE语句使用引号标识符。如果设置为0,禁用引号。默认情况下启用此选项,复制工作需要启用引号。

sql_safe_updates

If set to 1, MySQL aborts UPDATE or DELETE statements that do not use a key in the WHERE clause or a LIMIT clause. This makes it possible to catch UPDATE or DELETE statements where keys are not used properly and that would probably change or delete a large number of rows. The default value is 0.

如果设置为1,MySQL放弃执行未使用WHERE或LIMIT限定的 UPDATE和DELETE语句。默认为0.

sql_select_limit

The maximum number of rows to return from SELECT statements.

从SELECT语句返回的最大行数。

sql_slave_skip_counter

从机跳过的来自主机的事件数。

sql_warnings

This variable controls whether single-row INSERT statements produce an information string if warnings occur. The default is 0. Set the value to 1 to produce an information string.

这个变量控制是否单行INSERT语句产生一个信息字符串。(基于warning)。

默认值为0.(不产生)

storage_engine

该变量是table_typeis的同义词。在MySQL 5.1中,首选storage_engine。

stored_program_cache

Sets a soft upper limit for the number of cached stored routines per connection.

为每个连接缓存的存储实例设置上限的数量。

sync_binlog

如果为正,当每个sync_binlog'th写入该二进制日志后,MySQL服务器将它的二进制日志同步到硬盘上(fdatasync())。请注意如果在autocommit模式,每执行一个语句向二进制日志写入一次,否则每个事务写入一次。默认值是0,不与硬盘同步。值为1是最安全的选择,因为崩溃时,你最多丢掉二进制日志中的一个语句/事务;但是,这是最慢的选择(除非硬盘有电池备份缓存,从而使同步工作较快)。

sync_frm

如果该变量设为1,当创建非临时表时它的.frm文件被同步到硬盘上(fdatasync());这样较慢但出现崩溃时较安全。默认值为1。

sync_master_info

If the value of this variable is greater than 0,a replication slave synchronizes its master.info file to disk (using fdatasync()) after every sync_master_info events.

如果这个变量的值大于0,在每一个sync_master_info事件后,从机使用fdatasymc()将master.info文件同步到磁盘上。

sync_relay_log

If the value of this variable is greater than 0, the MySQL server synchronizes its relay log to disk (using fdatasync()) after every sync_relay_log writes to the relay log.

如果这个变量的值大于0,MySQL服务器在每一条sync_relay_log记录写入relay log之后,使用fdatasync()将relay log刷新到磁盘上。

sync_relay_log_info

If the value of this variable is greater than 0, a replication slave synchronizes its relay-log.info file to disk (using fdatasync()) after every sync_relay_log_info transactions. A value of 1 is the generally the best choice. The default value of sync_relay_log_info is 0,

如果这个变量的值大于0,在每一个sync_relay_log_info事务之后,从机使用fdatasync()将relay-log.info文件刷新到磁盘上。最佳值为1,默认值为0。

table_definition_cache

The number of table definitions that can be stored in the definition cache.

可以被缓存的表的数量。

table_lock_wait_timeout

这个变量已经不生效。于MySQL5.5.3版本移除。

table_open_cache

所有线程打开的表的数目。

table_type

这个变量已经在MySQL 5.5.3版本移除,并被storage_engine代替。

thread_cache_size

服务器应缓存多少线程以便重新使用。当客户端断开连接时,如果线程少于thread_cache_size,则客户端的线程被放入缓存。当请求线程时如果允许可以从缓存中重新利用线程,并且只有当缓存空了时才会创建新线程。如果新连接很多,可以增加该变量以提高性能。(一般情况,如果线程执行得很好,性能提高不明显)。检查Connections和Threads_created状态变量的差,你可以看见线程缓存的效率。

thread_pool_high_priority_connection

This variable affects queuing of new statements prior to execution.

这个变量会影响新语句执行之前的排队。

thread_pool_max_unused_threads

The maximum permitted number of unused threads in the thread pool. This variable makes it possible to limit the amount of memory used by sleeping threads.

闲置线程在线程池中允许的最大数量。这个变量可以限制睡眠线程占用的内存量。

thread_pool_prio_kickup_timer

This variable affects statements waiting for execution in the low-priority queue.

这个变量影响在低优先级队列中排队的语句。

thread_pool_stall_limit

This variable affects executing statements.

It is available only if the thread pool plugin is enabled.

这个变量会影响执行语句。

只有在线程池插件启用时可用。

time_zone

当前的时区。初使值是'SYSTEM'(使用system_time_zone的值),但可以用--default-time-zone选项在服务器启动时显式指定。

timed_mutexes

This variable controls whether InnoDB mutexes are timed.

这个变量控制是否进行InnoDB互斥计时。

timestamp

时间戳

tmp_table_size

如果内存内的临时表超过该值,MySQL自动将它转换为硬盘上的MyISAM表。如果你执行许多高级GROUP BY查询并且有大量内存,则可以增加tmp_table_size的值。

transaction_alloc_block_size

为保存将保存到二进制日志中的事务的查询而分配的内存块的大小(字节)。

transaction_prealloc_size

为transaction_alloc_blocks分配的固定缓冲区的大小(字节),在两次查询之间不会释放。使该值足够大,将所有查询固定到一个事务中,可以避免多次malloc()调用。

tx_isolation

默认事务隔离级别。默认值为REPEATABLE-READ。

unique_checks

If set to 1 (the default), uniqueness checks for secondary indexes in InnoDB tables are performed.

如果设置为1(默认),InnoDB表开启辅助索引的唯一性检查。

updatable_views_with_limit

This variable controls whether updates to a view can be made when the view does not contain all columns of the primary key defined in the underlying table, if the update statement contains a LIMIT clause.

这个变量控制,如果update语句包含一个limit约束,并且视图不包含所有在基础表中具有唯一索引的列, 是否可以更新视图。

wait_timeout

The number of seconds the server waits for activity on a noninteractive connection before closing it.

服务器等待一个非交互式连接的活动在它关闭之前的时间(秒)。

posted @ 2012-06-06 15:05  将语  阅读(1658)  评论(0编辑  收藏  举报