Pre-General Availability Draft: 2017-07-17
The MySQL server maintains many system variables that indicate how
it is configured. Each system variable has a default value. System
variables can be set at server startup using options on the
command line or in an option file. Most of them can be changed
dynamically at runtime using the
SET
statement, which enables you to modify operation of the server
without having to stop and restart it. Setting the global value of
a system variable requires the
SYSTEM_VARIABLES_ADMIN or
SUPER privilege. For some system
variables, setting the session value also requires the same
privilege; if so, it is indicated in the variable description. You
can also use system variable values in expressions.
There are several ways to see the names and values of system variables:
To see the values that a server will use based on its compiled-in defaults and any option files that it reads, use this command:
mysqld --verbose --helpTo see the values that a server will use based on its compiled-in defaults, ignoring the settings in any option files, use this command:
mysqld --no-defaults --verbose --helpTo see the current values used by a running server, use the
SHOW VARIABLESstatement or the Performance Schema system variable tables. See Section 25.11.13, “Performance Schema System Variable Tables”.
This section includes a table that lists all system variables and following the table provides a description of each one. Variables with no version indicated are present in all MySQL 8.0 releases. For more information about manipulation of system variables, see Section 5.1.6, “Using System Variables”.
Table 5.2 System Variable Summary
For additional system variable information, see these sections:
Section 5.1.6, “Using System Variables”, discusses the syntax for setting and displaying system variable values.
Section 5.1.6.2, “Dynamic System Variables”, lists the variables that can be set at runtime.
Information on tuning system variables can be found in Section 5.1.1, “Configuring the Server”.
Section 15.13, “InnoDB Startup Options and System Variables”, lists
InnoDBsystem variables.For information on server system variables specific to replication, see Section 18.1.6, “Replication and Binary Logging Options and Variables”.
Some of the following variable descriptions refer to
“enabling” or “disabling” a variable.
These variables can be enabled with the
SET
statement by setting them to ON or
1, or disabled by setting them to
OFF or 0. Boolean
variables can be set at startup to the values
ON, TRUE,
OFF, and FALSE (not case
sensitive), as well as 1 and
0. See Section 4.2.5, “Program Option Modifiers”.
Some system variables control the size of buffers or caches. For a given buffer, the server might need to allocate internal data structures. These structures typically are allocated from the total memory allocated to the buffer, and the amount of space required might be platform dependent. This means that when you assign a value to a system variable that controls a buffer size, the amount of space actually available might differ from the value assigned. In some cases, the amount might be less than the value assigned. It is also possible that the server will adjust a value upward. For example, if you assign a value of 0 to a variable for which the minimal value is 1024, the server will set the value to 1024.
Values for buffer sizes, lengths, and stack sizes are given in bytes unless otherwise specified.
Some system variables take file name values. Unless otherwise
specified, the default file location is the data directory if the
value is a relative path name. To specify the location explicitly,
use an absolute path name. Suppose that the data directory is
/var/mysql/data. If a file-valued variable is
given as a relative path name, it will be located under
/var/mysql/data. If the value is an absolute
path name, its location is as given by the path name.
-
Introduced 8.0.2 Command-Line Format --activate-all-roles-on-loginSystem Variable Name activate_all_roles_on_loginVariable Scope Global Dynamic Variable Yes Permitted Values Type boolean Default OFFWhether to enable automatic activation of all granted roles when users log in to the server:
If
activate_all_roles_on_loginis enabled, all roles granted to each account are activated at login time. This takes precedence over default roles specified withSET DEFAULT ROLE.If
activate_all_roles_on_loginis disabled, the default roles specified withSET DEFAULT ROLE, if any, are activated at login time.
Granted roles include those granted explicitly to the user and those named in the
mandatory_rolessystem variable value.activate_all_roles_on_loginapplies only at login time. For an already active user connection, granting additional roles to the user does not change the roles active within the session. To change the active roles within a session, useSET ROLE. -
Command-Line Format --autocommit[=#]System Variable Name autocommitVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type boolean Default ONThe autocommit mode. If set to 1, all changes to a table take effect immediately. If set to 0, you must use
COMMITto accept a transaction orROLLBACKto cancel it. Ifautocommitis 0 and you change it to 1, MySQL performs an automaticCOMMITof any open transaction. Another way to begin a transaction is to use aSTART TRANSACTIONorBEGINstatement. See Section 13.3.1, “START TRANSACTION, COMMIT, and ROLLBACK Syntax”.By default, client connections begin with
autocommitset to 1. To cause clients to begin with a default of 0, set the globalautocommitvalue by starting the server with the--autocommit=0option. To set the variable using an option file, include these lines:[mysqld] autocommit=0 -
System Variable Name automatic_sp_privilegesVariable Scope Global Dynamic Variable Yes Permitted Values Type boolean Default TRUEWhen this variable has a value of 1 (the default), the server automatically grants the
EXECUTEandALTER ROUTINEprivileges to the creator of a stored routine, if the user cannot already execute and alter or drop the routine. (TheALTER ROUTINEprivilege is required to drop the routine.) The server also automatically drops those privileges from the creator when the routine is dropped. Ifautomatic_sp_privilegesis 0, the server does not automatically add or drop these privileges.The creator of a routine is the account used to execute the
CREATEstatement for it. This might not be the same as the account named as theDEFINERin the routine definition.See also Section 23.2.2, “Stored Routines and MySQL Privileges”.
-
Command-Line Format --auto-generate-certs[={OFF|ON}]System Variable Name auto_generate_certsVariable Scope Global Dynamic Variable No Permitted Values Type boolean Default ONThis variable is available if the server was compiled using OpenSSL (see Section 6.4.1, “OpenSSL Versus yaSSL”). It controls whether the server autogenerates SSL key and certificate files in the data directory, if they do not already exist.
At startup, the server automatically generates server-side and client-side SSL certificate and key files in the data directory if the
auto_generate_certssystem variable is enabled, no SSL options other than--sslare specified, and the server-side SSL files are missing from the data directory. These files enable secure client connections using SSL; see Section 6.4.4, “Configuring MySQL to Use Secure Connections”.For more information about SSL file autogeneration, including file names and characteristics, see Section 6.4.6.1, “Creating SSL and RSA Certificates and Keys using MySQL”
The
sha256_password_auto_generate_rsa_keyssystem variable is related but controls autogeneration of RSA key-pair files needed for secure password exchange using RSA over unencypted connections. -
Deprecated 5.7.6 Command-Line Format --avoid-temporal-upgrade={OFF|ON}System Variable Name avoid_temporal_upgradeVariable Scope Global Dynamic Variable Yes Permitted Values Type boolean Default OFFThis variable controls whether
ALTER TABLEimplicitly upgrades temporal columns found to be in pre-5.6.4 format (TIME,DATETIME, andTIMESTAMPcolumns without support for fractional seconds precision). Upgrading such columns requires a table rebuild, which prevents any use of fast alterations that might otherwise apply to the operation to be performed.This variable is disabled by default. Enabling it causes
ALTER TABLEnot to rebuild temporal columns and thereby be able to take advantage of possible fast alterations.This variable is deprecated and will be removed in a future MySQL release.
-
System Variable Name back_logVariable Scope Global Dynamic Variable No Permitted Values Type integer Default -1 (autosized)Min Value 1Max Value 65535The number of outstanding connection requests MySQL can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time. It then takes some time (although very little) for the main thread to check the connection and start a new thread. The
back_logvalue indicates how many requests can be stacked during this short time before MySQL momentarily stops answering new requests. You need to increase this only if you expect a large number of connections in a short period of time.In other words, this value is the size of the listen queue for incoming TCP/IP connections. Your operating system has its own limit on the size of this queue. The manual page for the Unix
listen()system call should have more details. Check your OS documentation for the maximum value for this variable.back_logcannot be set higher than your operating system limit.The default value is based on the following formula, capped to a limit of 900:
50 + (max_connections / 5) -
Command-Line Format --basedir=dir_nameSystem Variable Name basedirVariable Scope Global Dynamic Variable No Permitted Values (<= 8.0.1) Type directory name Permitted Values (>= 8.0.2) Type directory name Default parent of mysqld installation directoryThe path to the MySQL installation base directory.
-
Command-Line Format --big-tablesSystem Variable Name big_tablesVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type boolean Default OFFIf set to 1, all temporary tables are stored on disk rather than in memory. This is a little slower, but the error
The tabledoes not occur fortbl_nameis fullSELECToperations that require a large temporary table. The default value for a new connection is 0 (use in-memory temporary tables). Normally, you should never need to set this variable, because in-memory tables are automatically converted to disk-based tables as required. -
Introduced 8.0.1 Command-Line Format --binlog-expire-logs-seconds=#System Variable Name binlog_expire_logs_secondsVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default 0Min Value 0Max Value 4294967295This variable sets the binary log expiration period in seconds.
The effects of this variable and
expire_logs_daysare cumulative; for example, ifexpire_logs_daysis 1 andbinlog_expire_logs_secondsis 43200, then the binary log is purged every 1.5 days. This produces the same result as settingbinlog_expire_logs_secondsto 129600 and leavingexpire_logs_daysset to 0.In MySQL 8.0, both
binlog_expire_logs_secondsandexpire_logs_daysmust be set to 0 to disable automatic purging of the binary log.To remove binary log files manually, use the
PURGE BINARY LOGSstatement. See Section 13.4.1.1, “PURGE BINARY LOGS Syntax”. -
Command-Line Format --bind-address=addrSystem Variable Name bind_addressVariable Scope Global Dynamic Variable No Permitted Values Type string Default *The value of the
--bind-addressoption. -
Command-Line Format --block-encryption-mode=#System Variable Name block_encryption_modeVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type string Default aes-128-ecbThis variable controls the block encryption mode for block-based algorithms such as AES. It affects encryption for
AES_ENCRYPT()andAES_DECRYPT().block_encryption_modetakes a value inaes-format, wherekeylen-modekeylenis the key length in bits andmodeis the encryption mode. The value is not case sensitive. Permittedkeylenvalues are 128, 192, and 256. Permitted encryption modes depend on whether MySQL was compiled using OpenSSL or yaSSL:For OpenSSL, permitted
modevalues are:ECB,CBC,CFB1,CFB8,CFB128,OFBFor yaSSL, permitted
modevalues are:ECB,CBC
For example, this statement causes the AES encryption functions to use a key length of 256 bits and the CBC mode:
SET block_encryption_mode = 'aes-256-cbc';An error occurs for attempts to set
block_encryption_modeto a value containing an unsupported key length or a mode that the SSL library does not support. -
Command-Line Format --bulk-insert-buffer-size=#System Variable Name bulk_insert_buffer_sizeVariable Scope Global, Session Dynamic Variable Yes Permitted Values (32-bit platforms) Type integer Default 8388608Min Value 0Max Value 4294967295Permitted Values (64-bit platforms) Type integer Default 8388608Min Value 0Max Value 18446744073709551615MyISAMuses a special tree-like cache to make bulk inserts faster forINSERT ... SELECT,INSERT ... VALUES (...), (...), ..., andLOAD DATA INFILEwhen adding data to nonempty tables. This variable limits the size of the cache tree in bytes per thread. Setting it to 0 disables this optimization. The default value is 8MB. -
System Variable Name character_set_clientVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type string The character set for statements that arrive from the client. The session value of this variable is set using the character set requested by the client when the client connects to the server. (Many clients support a
--default-character-setoption to enable this character set to be specified explicitly. See also Section 10.1.4, “Connection Character Sets and Collations”.) The global value of the variable is used to set the session value in cases when the client-requested value is unknown or not available, or the server is configured to ignore client requests:The client is from a version of MySQL older than MySQL 4.1, and thus does not request a character set.
The client requests a character set not known to the server. For example, a Japanese-enabled client requests
sjiswhen connecting to a server not configured withsjissupport.mysqld was started with the
--skip-character-set-client-handshakeoption, which causes it to ignore client character set configuration. This reproduces MySQL 4.0 behavior and is useful should you wish to upgrade the server without upgrading all the clients.
ucs2,utf16,utf16le, andutf32cannot be used as a client character set, which means that they also do not work forSET NAMESorSET CHARACTER SET. -
System Variable Name character_set_connectionVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type string The character set used for literals that do not have a character set introducer and for number-to-string conversion. For information about introducers, see Section 10.1.3.8, “Character Set Introducers”.
-
System Variable Name character_set_databaseVariable Scope Global, Session Dynamic Variable Yes Permitted Values (8.0.0) Type string Default latin1Permitted Values (>= 8.0.1) Type string Default utf8mb4Footnote This option is dynamic, but only the server should set this information. You should not set the value of this variable manually. The character set used by the default database. The server sets this variable whenever the default database changes. If there is no default database, the variable has the same value as
character_set_server.The global
character_set_databaseandcollation_databasesystem variables are deprecated and will be removed in a future version of MySQL.Assigning a value to the session
character_set_databaseandcollation_databasesystem variables is deprecated and assignments produce a warning. The session variables will become read only in a future version of MySQL and assignments will produce an error. It will remain possible to access the session variables to determine the database character set and collation for the default database. -
Command-Line Format --character-set-filesystem=nameSystem Variable Name character_set_filesystemVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type string Default binaryThe file system character set. This variable is used to interpret string literals that refer to file names, such as in the
LOAD DATA INFILEandSELECT ... INTO OUTFILEstatements and theLOAD_FILE()function. Such file names are converted fromcharacter_set_clienttocharacter_set_filesystembefore the file opening attempt occurs. The default value isbinary, which means that no conversion occurs. For systems on which multibyte file names are permitted, a different value may be more appropriate. For example, if the system represents file names using UTF-8, setcharacter_set_filesystemto'utf8'. -
System Variable Name character_set_resultsVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type string The character set used for returning query results such as result sets or error messages to the client.
-
Command-Line Format --character-set-serverSystem Variable Name character_set_serverVariable Scope Global, Session Dynamic Variable Yes Permitted Values (8.0.0) Type string Default latin1Permitted Values (>= 8.0.1) Type string Default utf8mb4The server's default character set.
-
System Variable Name character_set_systemVariable Scope Global Dynamic Variable No Permitted Values Type string Default utf8The character set used by the server for storing identifiers. The value is always
utf8. -
Command-Line Format --character-sets-dir=dir_nameSystem Variable Name character_sets_dirVariable Scope Global Dynamic Variable No Permitted Values Type directory name The directory where character sets are installed.
-
Command-Line Format --check-proxy-users=[={OFF|ON}]System Variable Name check_proxy_usersVariable Scope Global Dynamic Variable Yes Permitted Values Type boolean Default OFFThis variable controls whether the server performs proxy user mapping for authentication plugins that request it. With
check_proxy_usersenabled, it may also be necessary to enable plugin-specific system variables to take advantage of server proxy user mapping support:For the
mysql_native_passwordplugin, enablemysql_native_password_proxy_users.For the
sha256_passwordplugin, enablesha256_password_proxy_users.
For information about user proxying, see Section 6.3.11, “Proxy Users”.
-
System Variable Name collation_connectionVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type string The collation of the connection character set.
-
System Variable Name collation_databaseVariable Scope Global, Session Dynamic Variable Yes Permitted Values (8.0.0) Type string Default latin1_swedish_ciPermitted Values (>= 8.0.1) Type string Default utf8mb4_0900_ai_ciFootnote This option is dynamic, but only the server should set this information. You should not set the value of this variable manually. The collation used by the default database. The server sets this variable whenever the default database changes. If there is no default database, the variable has the same value as
collation_server.The global
character_set_databaseandcollation_databasesystem variables are deprecated and will be removed in a future version of MySQL.Assigning a value to the session
character_set_databaseandcollation_databasesystem variables is deprecated and assignments produce a warning. The session variables will become read only in a future version of MySQL and assignments will produce an error. It will remain possible to access the session variables to determine the database character set and collation for the default database. -
Command-Line Format --collation-serverSystem Variable Name collation_serverVariable Scope Global, Session Dynamic Variable Yes Permitted Values (8.0.0) Type string Default latin1_swedish_ciPermitted Values (>= 8.0.1) Type string Default utf8mb4_0900_ai_ciThe server's default collation.
-
Command-Line Format --completion-type=#System Variable Name completion_typeVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type enumeration Default NO_CHAINValid Values NO_CHAINCHAINRELEASE012The transaction completion type. This variable can take the values shown in the following table. The variable can be assigned using either the name values or corresponding integer values.
Value Description NO_CHAIN(or 0)COMMITandROLLBACKare unaffected. This is the default value.CHAIN(or 1)COMMITandROLLBACKare equivalent toCOMMIT AND CHAINandROLLBACK AND CHAIN, respectively. (A new transaction starts immediately with the same isolation level as the just-terminated transaction.)RELEASE(or 2)COMMITandROLLBACKare equivalent toCOMMIT RELEASEandROLLBACK RELEASE, respectively. (The server disconnects after terminating the transaction.)completion_typeaffects transactions that begin withSTART TRANSACTIONorBEGINand end withCOMMITorROLLBACK. It does not apply to implicit commits resulting from execution of the statements listed in Section 13.3.3, “Statements That Cause an Implicit Commit”. It also does not apply forXA COMMIT,XA ROLLBACK, or whenautocommit=1. -
Command-Line Format --concurrent-insert[=#]System Variable Name concurrent_insertVariable Scope Global Dynamic Variable Yes Permitted Values Type enumeration Default AUTOValid Values NEVERAUTOALWAYS012If
AUTO(the default), MySQL permitsINSERTandSELECTstatements to run concurrently forMyISAMtables that have no free blocks in the middle of the data file. If you start mysqld with--skip-new, this variable is set toNEVER.This variable can take the values shown in the following table. The variable can be assigned using either the name values or corresponding integer values.
Value Description NEVER(or 0)Disables concurrent inserts AUTO(or 1)(Default) Enables concurrent insert for MyISAMtables that do not have holesALWAYS(or 2)Enables concurrent inserts for all MyISAMtables, even those that have holes. For a table with a hole, new rows are inserted at the end of the table if it is in use by another thread. Otherwise, MySQL acquires a normal write lock and inserts the row into the hole.See also Section 8.11.3, “Concurrent Inserts”.
-
Command-Line Format --connect-timeout=#System Variable Name connect_timeoutVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default 10Min Value 2Max Value 31536000The number of seconds that the mysqld server waits for a connect packet before responding with
Bad handshake. The default value is 10 seconds.Increasing the
connect_timeoutvalue might help if clients frequently encounter errors of the formLost connection to MySQL server at '.XXX', system error:errno -
System Variable Name core_fileVariable Scope Global Dynamic Variable No Permitted Values Type boolean Default OFFWhether to write a core file if the server crashes. This variable is set by the
--core-fileoption. -
Command-Line Format --datadir=dir_nameSystem Variable Name datadirVariable Scope Global Dynamic Variable No Permitted Values Type directory name The path to the MySQL server data directory. Relative paths are resolved with respect to the current directory. If the server will be started automatically (that is, in contexts for which you cannot assume what the current directory will be), it is best to specify the
datadirvalue as an absolute path. This variable is unused. It is deprecated and will be removed in a future MySQL release.
This variable is unused. It is deprecated and will be removed in a future MySQL release.
-
Command-Line Format --debug[=debug_options]System Variable Name debugVariable Scope Global, Session Dynamic Variable Yes Permitted Values (Unix) Type string Default d:t:i:o,/tmp/mysqld.tracePermitted Values (Windows) Type string Default d:t:i:O,\mysqld.traceThis variable indicates the current debugging settings. It is available only for servers built with debugging support. The initial value comes from the value of instances of the
--debugoption given at server startup. The global and session values may be set at runtime. TheSYSTEM_VARIABLES_ADMINorSUPERprivilege is required, even for the session value.Assigning a value that begins with
+or-cause the value to added to or subtracted from the current value:mysql> SET debug = 'T'; mysql> SELECT @@debug; +---------+ | @@debug | +---------+ | T | +---------+ mysql> SET debug = '+P'; mysql> SELECT @@debug; +---------+ | @@debug | +---------+ | P:T | +---------+ mysql> SET debug = '-P'; mysql> SELECT @@debug; +---------+ | @@debug | +---------+ | T | +---------+For more information, see Section 28.5.3, “The DBUG Package”.
-
System Variable Name debug_syncVariable Scope Session Dynamic Variable Yes Permitted Values Type string This variable is the user interface to the Debug Sync facility. Use of Debug Sync requires that MySQL be configured with the
-DENABLE_DEBUG_SYNC=1CMake option (see Section 2.8.4, “MySQL Source-Configuration Options”). If Debug Sync is not compiled in, this system variable is not available.The global variable value is read only and indicates whether the facility is enabled. By default, Debug Sync is disabled and the value of
debug_syncisOFF. If the server is started with--debug-sync-timeout=, whereNNis a timeout value greater than 0, Debug Sync is enabled and the value ofdebug_syncisON - current signalfollowed by the signal name. Also,Nbecomes the default timeout for individual synchronization points.The session value can be read by any user and will have the same value as the global variable. The session value can be set by users that have the
SYSTEM_VARIABLES_ADMINorSUPERprivilege to control synchronization points.For a description of the Debug Sync facility and how to use synchronization points, see MySQL Internals: Test Synchronization.
-
Command-Line Format --default-authentication-plugin=plugin_nameSystem Variable Name default_authentication_pluginVariable Scope Global Dynamic Variable No Permitted Values Type enumeration Default mysql_native_passwordValid Values mysql_native_passwordsha256_passwordThe default authentication plugin. Permitted values are
mysql_native_password(use MySQL native passwords; this is the default) andsha256_password(use SHA-256 passwords). For more information about these plugins, see Section 6.5.1.1, “Native Pluggable Authentication”, and Section 6.5.1.2, “SHA-256 Pluggable Authentication”.NoteIf you use this variable to change the default authentication plugin to a value other than
mysql_native_password, clients older than MySQL 5.5.6 will no longer be able to connect because they will not understand the resulting change to the authentication protocol.The value of
default_authentication_pluginaffects these aspects of server operation:It determines which authentication plugin the server assigns to new accounts created by
CREATE USERandGRANTstatements that do not name a plugin explicitly with anIDENTIFIED WITHclause.It sets the
old_passwordssystem variable at startup to the value that is consistent with the password hashing method required by the default plugin. Theold_passwordsvalue affects hashing of passwords specified in theIDENTIFIED BYclause ofCREATE USERandGRANT, and passwords specified as the argument to thePASSWORD()function.For an account created with either of the following statements, the server associates the account with the default authentication plugin and assigns the account the given password, hashed according to the value of
old_passwords.CREATE USER ... IDENTIFIED BY 'cleartext password'; GRANT ... IDENTIFIED BY 'cleartext password';For an account created with either of the following statements, the statement fails if the password hash is not encrypted using the hash format required by the default authentication plugin. Otherwise, the server associates the account with the default authentication plugin and assigns the account the given password hash.
CREATE USER ... IDENTIFIED BY PASSWORD 'encrypted password'; GRANT ... IDENTIFIED BY PASSWORD 'encrypted password';
-
Command-Line Format --default-password-lifetime=#System Variable Name default_password_lifetimeVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default 0Min Value 0Max Value 65535This variable defines the global automatic password expiration policy. It applies to accounts that use MySQL built-in authentication methods (accounts that use an authentication plugin of
mysql_native_passwordorsha256_password).The default
default_password_lifetimevalue is 0, which disables automatic password expiration. If the value ofdefault_password_lifetimeis a positive integerN, it indicates the permitted password lifetime; passwords must be changed everyNdays.The global password expiration policy can be overridden as desired for individual accounts using the
ALTER USERstatement. See Section 6.3.8, “Password Expiration Policy”. -
Command-Line Format --default-storage-engine=nameSystem Variable Name default_storage_engineVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type enumeration Default InnoDBThe default storage engine. This variable sets the storage engine for permanent tables only. To set the storage engine for
TEMPORARYtables, set thedefault_tmp_storage_enginesystem variable.To see which storage engines are available and enabled, use the
SHOW ENGINESstatement or query theINFORMATION_SCHEMAENGINEStable.If you disable the default storage engine at server startup, you must set the default engine for both permanent and
TEMPORARYtables to a different engine or the server will not start. -
Command-Line Format --default-tmp-storage-engine=nameSystem Variable Name default_tmp_storage_engineVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type enumeration Default InnoDBThe default storage engine for
TEMPORARYtables (created withCREATE TEMPORARY TABLE). To set the storage engine for permanent tables, set thedefault_storage_enginesystem variable. Also see the discussion of that variable regarding possible values.If you disable the default storage engine at server startup, you must set the default engine for both permanent and
TEMPORARYtables to a different engine or the server will not start. -
Command-Line Format --default-week-format=#System Variable Name default_week_formatVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default 0Min Value 0Max Value 7The default mode value to use for the
WEEK()function. See Section 12.7, “Date and Time Functions”. -
Command-Line Format --delay-key-write[=name]System Variable Name delay_key_writeVariable Scope Global Dynamic Variable Yes Permitted Values Type enumeration Default ONValid Values ONOFFALLThis option applies only to
MyISAMtables. It can have one of the following values to affect handling of theDELAY_KEY_WRITEtable option that can be used inCREATE TABLEstatements.Option Description OFFDELAY_KEY_WRITEis ignored.ONMySQL honors any DELAY_KEY_WRITEoption specified inCREATE TABLEstatements. This is the default value.ALLAll new opened tables are treated as if they were created with the DELAY_KEY_WRITEoption enabled.If
DELAY_KEY_WRITEis enabled for a table, the key buffer is not flushed for the table on every index update, but only when the table is closed. This speeds up writes on keys a lot, but if you use this feature, you should add automatic checking of allMyISAMtables by starting the server with the--myisam-recover-optionsoption (for example,--myisam-recover-options=BACKUP,FORCE). See Section 5.1.4, “Server Command Options”, and Section 16.2.1, “MyISAM Startup Options”.WarningIf you enable external locking with
--external-locking, there is no protection against index corruption for tables that use delayed key writes. -
Deprecated 5.6.7 Command-Line Format --delayed-insert-limit=#System Variable Name delayed_insert_limitVariable Scope Global Dynamic Variable Yes Permitted Values (32-bit platforms) Type integer Default 100Min Value 1Max Value 4294967295Permitted Values (64-bit platforms) Type integer Default 100Min Value 1Max Value 18446744073709551615This system variable is deprecated (because
DELAYEDinserts are not supported), and will be removed in a future release. -
Deprecated 5.6.7 Command-Line Format --delayed-insert-timeout=#System Variable Name delayed_insert_timeoutVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default 300This system variable is deprecated (because
DELAYEDinserts are not supported), and will be removed in a future release. -
Deprecated 5.6.7 Command-Line Format --delayed-queue-size=#System Variable Name delayed_queue_sizeVariable Scope Global Dynamic Variable Yes Permitted Values (32-bit platforms) Type integer Default 1000Min Value 1Max Value 4294967295Permitted Values (64-bit platforms) Type integer Default 1000Min Value 1Max Value 18446744073709551615This system variable is deprecated (because
DELAYEDinserts are not supported), and will be removed in a future release. -
Command-Line Format --disabled-storage-engines=engine[,engine]...System Variable Name disabled_storage_enginesVariable Scope Global Dynamic Variable No Permitted Values Type string Default empty stringThis variable indicates which storage engines cannot be used to create tables or tablespaces. For example, to prevent new
MyISAMorFEDERATEDtables from being created, start the server with these lines in the server option file:[mysqld] disabled_storage_engines="MyISAM,FEDERATED"By default,
disabled_storage_enginesis empty (no engines disabled), but it can be set to a comma-separated list of one or more engines (not case sensitive). Any engine named in the value cannot be used to create tables or tablespaces withCREATE TABLEorCREATE TABLESPACE, and cannot be used withALTER TABLE ... ENGINEorALTER TABLESPACE ... ENGINEto change the storage engine of existing tables or tablespaces. Attempts to do so result in anER_DISABLED_STORAGE_ENGINEerror.disabled_storage_enginesdoes not restrict other DDL statements for existing tables, such asCREATE INDEX,TRUNCATE TABLE,ANALYZE TABLE,DROP TABLE, orDROP TABLESPACE. This permits a smooth transition so that existing tables or tablespaces that use a disabled engine can be migrated to a permitted engine by means such asALTER TABLE ... ENGINE.permitted_engineIt is permitted to set the
default_storage_engineordefault_tmp_storage_enginesystem variable to a storage engine that is disabled. This could cause applications to behave erratically or fail, although that might be a useful technique in a development environment for identifying applications that use disabled engines, so that they can be modified.disabled_storage_enginesis disabled and has no effect if the server is started with any of these options:--initialize,--initialize-insecure,--skip-grant-tables. disconnect_on_expired_passwordCommand-Line Format --disconnect-on-expired-password[=#]System Variable Name disconnect_on_expired_passwordVariable Scope Session Dynamic Variable No Permitted Values Type boolean Default ONThis variable controls how the server handles clients with expired passwords:
If the client indicates that it can handle expires passwords, the value of
disconnect_on_expired_passwordis irrelevant. The server permits the client to connect but puts it in sandbox mode.If the client does not indicate that it can handle expires passwords, the server handles the client according to the value of
disconnect_on_expired_password:If
disconnect_on_expired_password: is enabled, the server disconnects the client.If
disconnect_on_expired_password: is disabled, the server permits the client to connect but puts it in sandbox mode.
For more information about the interaction of client and server settings relating to expired-password handling, see Section 6.3.9, “Password Expiration and Sandbox Mode”.
-
Command-Line Format --div-precision-increment=#System Variable Name div_precision_incrementVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default 4Min Value 0Max Value 30This variable indicates the number of digits by which to increase the scale of the result of division operations performed with the
/operator. The default value is 4. The minimum and maximum values are 0 and 30, respectively. The following example illustrates the effect of increasing the default value.mysql> SELECT 1/7; +--------+ | 1/7 | +--------+ | 0.1429 | +--------+ mysql> SET div_precision_increment = 12; mysql> SELECT 1/7; +----------------+ | 1/7 | +----------------+ | 0.142857142857 | +----------------+ -
System Variable Name end_markers_in_jsonVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type boolean Default OFFWhether optimizer JSON output should add end markers. See MySQL Internals: The end_markers_in_json System Variable.
-
System Variable Name eq_range_index_dive_limitVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default 200Min Value 0Max Value 4294967295This variable indicates the number of equality ranges in an equality comparison condition when the optimizer should switch from using index dives to index statistics in estimating the number of qualifying rows. It applies to evaluation of expressions that have either of these equivalent forms, where the optimizer uses a nonunique index to look up
col_namevalues:col_name IN(val1, ..., valN) col_name = val1 OR ... OR col_name = valNIn both cases, the expression contains
Nequality ranges. The optimizer can make row estimates using index dives or index statistics. Ifeq_range_index_dive_limitis greater than 0, the optimizer uses existing index statistics instead of index dives if there areeq_range_index_dive_limitor more equality ranges. Thus, to permit use of index dives for up toNequality ranges, seteq_range_index_dive_limittoN+ 1. To disable use of index statistics and always use index dives regardless ofN, seteq_range_index_dive_limitto 0.For more information, see Equality Range Optimization of Many-Valued Comparisons.
To update table index statistics for best estimates, use
ANALYZE TABLE. The number of errors that resulted from the last statement that generated messages. This variable is read only. See Section 13.7.5.17, “SHOW ERRORS Syntax”.
-
Command-Line Format --event-scheduler[=value]System Variable Name event_schedulerVariable Scope Global Dynamic Variable Yes Permitted Values Type enumeration Default OFFValid Values ONOFFDISABLEDThis variable indicates the status of the Event Scheduler; possible values are
ON,OFF, andDISABLED, with the default beingOFF. This variable and its effects on the Event Scheduler's operation are discussed in greater detail in the Overview section of the Events chapter. -
Command-Line Format --expire-logs-days=#System Variable Name expire_logs_daysVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default 0Min Value 0Max Value 99Permitted Values (>= 8.0.2) Type integer Default 30Min Value 0Max Value 99The number of days before automatic removal of binary log files. The default is 30, which means binary log files are removed after 30 days. Setting this variable to 0 means “no automatic removal”. Possible removals happen at startup and when the binary log is flushed. Log flushing occurs as indicated in Section 5.4, “MySQL Server Logs”.
This variable sets the binary log expiration period in whole days. To set this interval to less than one day, use
binlog_expire_logs_seconds. The effect of the two variables are cumulative; for example, ifexpire_logs_days= 1 andbinlog_expire_logs_seconds= 43200, then the binary log is purged every 1.5 days.In MySQL 8.0, both
binlog_expire_logs_secondsandexpire_logs_daysmust be set to 0 to disable automatic purging of the binary log.To remove binary log files manually, use the
PURGE BINARY LOGSstatement. See Section 13.4.1.1, “PURGE BINARY LOGS Syntax”. explicit_defaults_for_timestampDeprecated 5.6.6 Command-Line Format --explicit-defaults-for-timestamp=#System Variable Name explicit_defaults_for_timestampVariable Scope Global, Session Dynamic Variable Yes Permitted Values (<= 8.0.1) Type boolean Default OFFPermitted Values (>= 8.0.2) Type boolean Default ONThis system variable determines whether the server enables certain nonstandard behaviors for default values and
NULL-value handling inTIMESTAMPcolumns. By default,explicit_defaults_for_timestampis enabled, which disables the nonstandard behaviors. Disablingexplicit_defaults_for_timestampresults in a warning. (Before MySQL 8.0.2,explicit_defaults_for_timestampis disabled, which enables the nonstandard behaviors.)If
explicit_defaults_for_timestampis disabled, the server enables the nonstandard behaviors and handlesTIMESTAMPcolumns as follows:TIMESTAMPcolumns not explicitly declared with theNULLattribute are automatically declared with theNOT NULLattribute. Assigning such a column a value ofNULLis permitted and sets the column to the current timestamp.The first
TIMESTAMPcolumn in a table, if not explicitly declared with theNULLattribute or an explicitDEFAULTorON UPDATEattribute, is automatically declared with theDEFAULT CURRENT_TIMESTAMPandON UPDATE CURRENT_TIMESTAMPattributes.TIMESTAMPcolumns following the first one, if not explicitly declared with theNULLattribute or an explicitDEFAULTattribute, are automatically declared asDEFAULT '0000-00-00 00:00:00'(the “zero” timestamp). For inserted rows that specify no explicit value for such a column, the column is assigned'0000-00-00 00:00:00'and no warning occurs.Depending on whether strict SQL mode or the
NO_ZERO_DATESQL mode is enabled, a default value of'0000-00-00 00:00:00'may be invalid. Be aware that theTRADITIONALSQL mode includes strict mode andNO_ZERO_DATE. See Section 5.1.8, “Server SQL Modes”.
The nonstandard behaviors just described are deprecated and will be removed in a future MySQL release.
If
explicit_defaults_for_timestampis enabled, the server disables the nonstandard behaviors and handlesTIMESTAMPcolumns as follows:It is not possible to assign a
TIMESTAMPcolumn a value ofNULLto set it to the current timestamp. To assign the current timestamp, set the column toCURRENT_TIMESTAMPor a synonym such asNOW().TIMESTAMPcolumns not explicitly declared with theNOT NULLattribute are automatically declared with theNULLattribute and permitNULLvalues. Assigning such a column a value ofNULLsets it toNULL, not the current timestamp.TIMESTAMPcolumns declared with theNOT NULLattribute do not permitNULLvalues. For inserts that specifyNULLfor such a column, the result is either an error for a single-row insert or if strict SQL mode is enabled, or'0000-00-00 00:00:00'is inserted for multiple-row inserts with strict SQL mode disabled. In no case does assigning the column a value ofNULLset it to the current timestamp.TIMESTAMPcolumns explicitly declared with theNOT NULLattribute and without an explicitDEFAULTattribute are treated as having no default value. For inserted rows that specify no explicit value for such a column, the result depends on the SQL mode. If strict SQL mode is enabled, an error occurs. If strict SQL mode is not enabled, the column is declared with the implicit default of'0000-00-00 00:00:00'and a warning occurs. This is similar to how MySQL treats other temporal types such asDATETIME.No
TIMESTAMPcolumn is automatically declared with theDEFAULT CURRENT_TIMESTAMPorON UPDATE CURRENT_TIMESTAMPattributes. Those attributes must be explicitly specified.The first
TIMESTAMPcolumn in a table is not handled differently fromTIMESTAMPcolumns following the first one.
If
explicit_defaults_for_timestampis disabled at server startup, this warning appears in the error log:[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).As indicated by the warning, to disable the deprecated nonstandard behaviors, enable the
explicit_defaults_for_timestampsystem variable at server startup.Noteexplicit_defaults_for_timestampis itself deprecated because its only purpose is to permit control over deprecatedTIMESTAMPbehaviors that are to be removed in a future MySQL release. When removal of those behaviors occurs,explicit_defaults_for_timestampwill have no purpose and will be removed as well.For additional information, see Section 11.3.5, “Automatic Initialization and Updating for TIMESTAMP and DATETIME”.
-
System Variable Name external_userVariable Scope Session Dynamic Variable No Permitted Values Type string The external user name used during the authentication process, as set by the plugin used to authenticate the client. With native (built-in) MySQL authentication, or if the plugin does not set the value, this variable is
NULL. See Section 6.3.11, “Proxy Users”. -
Command-Line Format --flushSystem Variable Name flushVariable Scope Global Dynamic Variable Yes Permitted Values Type boolean Default OFFIf
ON, the server flushes (synchronizes) all changes to disk after each SQL statement. Normally, MySQL does a write of all changes to disk only after each SQL statement and lets the operating system handle the synchronizing to disk. See Section B.5.3.3, “What to Do If MySQL Keeps Crashing”. This variable is set toONif you start mysqld with the--flushoption. -
Command-Line Format --flush-time=#System Variable Name flush_timeVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default 0Min Value 0Permitted Values (Windows) Type integer Default 0Min Value 0If this is set to a nonzero value, all tables are closed every
flush_timeseconds to free up resources and synchronize unflushed data to disk. This option is best used only on systems with minimal resources. -
System Variable Name foreign_key_checksVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type boolean Default 1If set to 1 (the default), foreign key constraints for
InnoDBtables are checked. If set to 0, foreign key constraints are ignored, with a couple of exceptions. When re-creating a table that was dropped, an error is returned if the table definition does not conform to the foreign key constraints referencing the table. Likewise, anALTER TABLEoperation returns an error if a foreign key definition is incorrectly formed. For more information, see Section 13.1.15.6, “Using FOREIGN KEY Constraints”.Typically you leave this setting enabled during normal operation, to enforce referential integrity. Disabling foreign key checking can be useful for reloading
InnoDBtables in an order different from that required by their parent/child relationships. See Section 15.8.1.6, “InnoDB and FOREIGN KEY Constraints”.Setting
foreign_key_checksto 0 also affects data definition statements:DROP SCHEMAdrops a schema even if it contains tables that have foreign keys that are referred to by tables outside the schema, andDROP TABLEdrops tables that have foreign keys that are referred to by other tables.NoteSetting
foreign_key_checksto 1 does not trigger a scan of the existing table data. Therefore, rows added to the table whileforeign_key_checks = 0will not be verified for consistency.Dropping an index required by a foreign key constraint is not permitted, even with
foreign_key_checks=0. The foreign key constraint must be removed before dropping the index. -
Command-Line Format --ft-boolean-syntax=nameSystem Variable Name ft_boolean_syntaxVariable Scope Global Dynamic Variable Yes Permitted Values Type string Default + -><()~*:""&|The list of operators supported by boolean full-text searches performed using
IN BOOLEAN MODE. See Section 12.9.2, “Boolean Full-Text Searches”.The default variable value is
'+ -><()~*:""&|'. The rules for changing the value are as follows:Operator function is determined by position within the string.
The replacement value must be 14 characters.
Each character must be an ASCII nonalphanumeric character.
Either the first or second character must be a space.
No duplicates are permitted except the phrase quoting operators in positions 11 and 12. These two characters are not required to be the same, but they are the only two that may be.
Positions 10, 13, and 14 (which by default are set to
:,&, and|) are reserved for future extensions.
-
Command-Line Format --ft-max-word-len=#System Variable Name ft_max_word_lenVariable Scope Global Dynamic Variable No Permitted Values Type integer Min Value 10The maximum length of the word to be included in a
MyISAMFULLTEXTindex.NoteFULLTEXTindexes onMyISAMtables must be rebuilt after changing this variable. UseREPAIR TABLE.tbl_nameQUICK -
Command-Line Format --ft-min-word-len=#System Variable Name ft_min_word_lenVariable Scope Global Dynamic Variable No Permitted Values Type integer Default 4Min Value 1The minimum length of the word to be included in a
MyISAMFULLTEXTindex.NoteFULLTEXTindexes onMyISAMtables must be rebuilt after changing this variable. UseREPAIR TABLE.tbl_nameQUICK -
Command-Line Format --ft-query-expansion-limit=#System Variable Name ft_query_expansion_limitVariable Scope Global Dynamic Variable No Permitted Values Type integer Default 20Min Value 0Max Value 1000The number of top matches to use for full-text searches performed using
WITH QUERY EXPANSION. -
Command-Line Format --ft-stopword-file=file_nameSystem Variable Name ft_stopword_fileVariable Scope Global Dynamic Variable No Permitted Values Type file name The file from which to read the list of stopwords for full-text searches on
MyISAMtables. The server looks for the file in the data directory unless an absolute path name is given to specify a different directory. All the words from the file are used; comments are not honored. By default, a built-in list of stopwords is used (as defined in thestorage/myisam/ft_static.cfile). Setting this variable to the empty string ('') disables stopword filtering. See also Section 12.9.4, “Full-Text Stopwords”.NoteFULLTEXTindexes onMyISAMtables must be rebuilt after changing this variable or the contents of the stopword file. UseREPAIR TABLE.tbl_nameQUICK -
Command-Line Format --general-logSystem Variable Name general_logVariable Scope Global Dynamic Variable Yes Permitted Values Type boolean Default OFFWhether the general query log is enabled. The value can be 0 (or
OFF) to disable the log or 1 (orON) to enable the log. The default value depends on whether the--general_logoption is given. The destination for log output is controlled by thelog_outputsystem variable; if that value isNONE, no log entries are written even if the log is enabled. -
Command-Line Format --general-log-file=file_nameSystem Variable Name general_log_fileVariable Scope Global Dynamic Variable Yes Permitted Values Type file name Default host_name.logThe name of the general query log file. The default value is
, but the initial value can be changed with thehost_name.log--general_log_fileoption. -
Command-Line Format --group-concat-max-len=#System Variable Name group_concat_max_lenVariable Scope Global, Session Dynamic Variable Yes Permitted Values (32-bit platforms) Type integer Default 1024Min Value 4Max Value 4294967295Permitted Values (64-bit platforms) Type integer Default 1024Min Value 4Max Value 18446744073709551615The maximum permitted result length in bytes for the
GROUP_CONCAT()function. The default is 1024. YESif thezlibcompression library is available to the server,NOif not. If not, theCOMPRESS()andUNCOMPRESS()functions cannot be used.YESif thecrypt()system call is available to the server,NOif not. If not, theENCRYPT()function cannot be used.YESif mysqld supports dynamic loading of plugins,NOif not. If the value isNO, you cannot use options such as--plugin-loadto load plugins at server startup, or theINSTALL PLUGINstatement to load plugins at runtime.YESif the server supports spatial data types,NOif not.This variable is an alias for
have_ssl.YESif statement profiling capability is present,NOif not. If present, theprofilingsystem variable controls whether this capability is enabled or disabled. See Section 13.7.5.31, “SHOW PROFILES Syntax”.This variable is deprecated and will be removed in a future MySQL release.
YESif mysqld supports the query cache,NOif not.YESifRTREEindexes are available,NOif not. (These are used for spatial indexes inMyISAMtables.)YESif mysqld supports SSL connections,NOif not.DISABLEDindicates that the server was compiled with SSL support, but was not started with the appropriate--ssl-options. For more information, see Section 6.4.2, “Building MySQL with Support for Secure Connections”.xxx-
System Variable Name have_statement_timeoutVariable Scope Global Dynamic Variable No Permitted Values Type boolean Whether the statement execution timeout feature is available (see Statement Execution Time Optimizer Hints). The value can be
NOif the background thread used by this feature could not be initialized. YESif symbolic link support is enabled,NOif not. This is required on Unix for support of theDATA DIRECTORYandINDEX DIRECTORYtable options. If the server is started with the--skip-symbolic-linksoption, the value isDISABLED.This variable has no meaning on Windows.
NoteAs of MySQL 8.0.2, symbolic link support, along with the the
--symbolic-linksoption that controls it, is deprecated and will be removed in a future version of MySQL. In addition, the option is disabled by default. The relatedhave_symlinksystem variable also is deprecated and will be removed in a future version of MySQL.histogram_generation_max_mem_sizeIntroduced 8.0.2 Command-Line Format --histogram-generation-max-mem-size=#System Variable Name histogram_generation_max_mem_sizeVariable Scope Global, Session Dynamic Variable Yes Permitted Values (32-bit platforms) Type integer Default 20000000Min Value 1000000Max Value 4294967295Permitted Values (64-bit platforms) Type integer Default 20000000Min Value 1000000Max Value 18446744073709551615The maximum amount of memory available for generating histogram statistics. See Section 8.9.6, “Optimizer Statistics”, and Section 13.7.2.1, “ANALYZE TABLE Syntax”.
The global and session values may be set at runtime. The
SYSTEM_VARIABLES_ADMINorSUPERprivilege is required, even for the session value.-
System Variable Name host_cache_sizeVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default -1 (autosized)Min Value 0Max Value 65536The size of the internal host cache (see Section 8.12.4.2, “DNS Lookup Optimization and the Host Cache”). Setting the size to 0 disables the host cache. Changing the cache size at runtime implicitly causes a
FLUSH HOSTSoperation to clear the host cache and truncate thehost_cachetable.The default value is 128, plus 1 for a value of
max_connectionsup to 500, plus 1 for every increment of 20 over 500 in themax_connectionsvalue, capped to a limit of 2000.Use of
--skip-host-cacheis similar to setting thehost_cache_sizesystem variable to 0, buthost_cache_sizeis more flexible because it can also be used to resize, enable, or disable the host cache at runtime, not just at server startup.If you start the server with
--skip-host-cache, that does not prevent changes to the value ofhost_cache_size, but such changes have no effect and the cache is not re-enabled even ifhost_cache_sizeis set larger than 0. -
System Variable Name hostnameVariable Scope Global Dynamic Variable No Permitted Values Type string The server sets this variable to the server host name at startup.
This variable is a synonym for the
last_insert_idvariable. It exists for compatibility with other database systems. You can read its value withSELECT @@identity, and set it usingSET identity.-
Command-Line Format --init-connect=nameSystem Variable Name init_connectVariable Scope Global Dynamic Variable Yes Permitted Values Type string A string to be executed by the server for each client that connects. The string consists of one or more SQL statements, separated by semicolon characters. For example, each client session begins by default with autocommit mode enabled. For older servers (before MySQL 5.5.8), there is no global
autocommitsystem variable to specify that autocommit should be disabled by default, but as a workaroundinit_connectcan be used to achieve the same effect:SET GLOBAL init_connect='SET autocommit=0';The
init_connectvariable can also be set on the command line or in an option file. To set the variable as just shown using an option file, include these lines:[mysqld] init_connect='SET autocommit=0'For users that have the
CONNECTION_ADMINorSUPERprivilege, the content ofinit_connectis not executed. This is done so that an erroneous value forinit_connectdoes not prevent all clients from connecting. For example, the value might contain a statement that has a syntax error, thus causing client connections to fail. Not executinginit_connectfor users that have theCONNECTION_ADMINorSUPERprivilege enables them to open a connection and fix theinit_connectvalue.The server discards any result sets produced by statements in the value of of
init_connect. -
Command-Line Format --information-schema-stats=valueSystem Variable Name information_schema_statsVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type enumeration Default CACHEDValid Values CACHEDLATESTSome
INFORMATION_SCHEMAtables contain columns that provide table statistics:STATISTICS.CARDINALITY TABLES.AUTO_INCREMENT TABLES.AVG_ROW_LENGTH TABLES.CHECKSUM TABLES.CHECK_TIME TABLES.CREATE_TIME TABLES.DATA_FREE TABLES.DATA_LENGTH TABLES.INDEX_LENGTH TABLES.MAX_DATA_LENGTH TABLES.TABLE_ROWS TABLES.UPDATE_TIMEThose columns represent dynamic table metadata; that is, information that changes as table contents change.
The
information_schema_statssystem variable determines the source from which the server retrieves table statistics:If the value is
CACHED(the default), the server retrieves statistics fromINFORMATION_SCHEMAtables that hold cached values (STATISTICSandTABLES). When the server starts, the cached statistics areNULL. To update the cached values for a given table, useANALYZE TABLE.If the value is
LATEST, the server reads statistics directly from storage engines.
NoteIf the
innodb_read_onlysystem variable is enabled,ANALYZE TABLEmay fail because it cannot update statistics tables in the data dictionary, which useInnoDB. ForANALYZE TABLEoperations that update the key distribution, failure may occur even if the operation updates the table itself (for example, if it is aMyISAMtable). To obtain the updated distribution statistics, setinformation_schema_stats=LATEST.For additional information, see Section 8.2.3, “Optimizing INFORMATION_SCHEMA Queries”.
-
Command-Line Format --init-file=file_nameSystem Variable Name init_fileVariable Scope Global Dynamic Variable No Permitted Values Type file name The name of the file specified with the
--init-fileoption when you start the server. This should be a file containing SQL statements that you want the server to execute when it starts. Each statement must be on a single line and should not include comments. For more information, see the description of--init-file. innodb_xxxInnoDBsystem variables are listed in Section 15.13, “InnoDB Startup Options and System Variables”. These variables control many aspects of storage, memory use, and I/O patterns forInnoDBtables, and are especially important now thatInnoDBis the default storage engine.The value to be used by the following
INSERTorALTER TABLEstatement when inserting anAUTO_INCREMENTvalue. This is mainly used with the binary log.-
Command-Line Format --interactive-timeout=#System Variable Name interactive_timeoutVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default 28800Min Value 1The number of seconds the server waits for activity on an interactive connection before closing it. An interactive client is defined as a client that uses the
CLIENT_INTERACTIVEoption tomysql_real_connect(). See alsowait_timeout. internal_tmp_disk_storage_engineCommand-Line Format --internal-tmp-disk-storage-engine=#System Variable Name internal_tmp_disk_storage_engineVariable Scope Global Dynamic Variable Yes Permitted Values Type enumeration Default INNODBValid Values MYISAMINNODBThe storage engine for on-disk internal temporary tables (see Section 8.4.4, “Internal Temporary Table Use in MySQL”). Permitted values are
MYISAMandINNODB(the default).Under
internal_tmp_disk_storage_engine=INNODB, queries that generate temporary tables that exceedInnoDBrow or column limits will return Row size too large or Too many columns errors. The workaround is to setinternal_tmp_disk_storage_enginetoMYISAM.internal_tmp_mem_storage_engineIntroduced 8.0.2 Command-Line Format --internal-tmp-mem-storage-engine=#System Variable Name internal_tmp_mem_storage_engineVariable Scope Session Dynamic Variable Yes Permitted Values Type enumeration Default TempTableValid Values TempTableMEMORYThe storage engine for in-memory internal temporary tables (see Section 8.4.4, “Internal Temporary Table Use in MySQL”). Permitted values are
TempTable(the default) andMEMORY.-
Command-Line Format --join-buffer-size=#System Variable Name join_buffer_sizeVariable Scope Global, Session Dynamic Variable Yes Permitted Values (Windows) Type integer Default 262144Min Value 128Max Value 4294967295Permitted Values (Other, 32-bit platforms) Type integer Default 262144Min Value 128Max Value 4294967295Permitted Values (Other, 64-bit platforms) Type integer Default 262144Min Value 128Max Value 18446744073709547520The minimum size of the buffer that is used for plain index scans, range index scans, and joins that do not use indexes and thus perform full table scans. Normally, the best way to get fast joins is to add indexes. Increase the value of
join_buffer_sizeto get a faster full join when adding indexes is not possible. One join buffer is allocated for each full join between two tables. For a complex join between several tables for which indexes are not used, multiple join buffers might be necessary.Unless Batched Key Access (BKA) is used, there is no gain from setting the buffer larger than required to hold each matching row, and all joins allocate at least the minimum size, so use caution in setting this variable to a large value globally. It is better to keep the global setting small and change to a larger setting only in sessions that are doing large joins. Memory allocation time can cause substantial performance drops if the global size is larger than needed by most queries that use it.
When BKA is used, the value of
join_buffer_sizedefines how large the batch of keys is in each request to the storage engine. The larger the buffer, the more sequential access will be to the right hand table of a join operation, which can significantly improve performance.The default is 256KB. The maximum permissible setting for
join_buffer_sizeis 4GB−1. Larger values are permitted for 64-bit platforms (except 64-bit Windows, for which large values are truncated to 4GB−1 with a warning).For additional information about join buffering, see Section 8.2.1.6, “Nested-Loop Join Algorithms”. For information about Batched Key Access, see Section 8.2.1.11, “Block Nested-Loop and Batched Key Access Joins”.
-
Command-Line Format --keep-files-on-create=#System Variable Name keep_files_on_createVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type boolean Default OFFIf a
MyISAMtable is created with noDATA DIRECTORYoption, the.MYDfile is created in the database directory. By default, ifMyISAMfinds an existing.MYDfile in this case, it overwrites it. The same applies to.MYIfiles for tables created with noINDEX DIRECTORYoption. To suppress this behavior, set thekeep_files_on_createvariable toON(1), in which caseMyISAMwill not overwrite existing files and returns an error instead. The default value isOFF(0).If a
MyISAMtable is created with aDATA DIRECTORYorINDEX DIRECTORYoption and an existing.MYDor.MYIfile is found, MyISAM always returns an error. It will not overwrite a file in the specified directory. -
Command-Line Format --key-buffer-size=#System Variable Name key_buffer_sizeVariable Scope Global Dynamic Variable Yes Permitted Values (32-bit platforms) Type integer Default 8388608Min Value 8Max Value 4294967295Permitted Values (64-bit platforms) Type integer Default 8388608Min Value 8Max Value OS_PER_PROCESS_LIMITIndex blocks for
MyISAMtables are buffered and are shared by all threads.key_buffer_sizeis the size of the buffer used for index blocks. The key buffer is also known as the key cache.The maximum permissible setting for
key_buffer_sizeis 4GB−1 on 32-bit platforms. Larger values are permitted for 64-bit platforms. The effective maximum size might be less, depending on your available physical RAM and per-process RAM limits imposed by your operating system or hardware platform. The value of this variable indicates the amount of memory requested. Internally, the server allocates as much memory as possible up to this amount, but the actual allocation might be less.You can increase the value to get better index handling for all reads and multiple writes; on a system whose primary function is to run MySQL using the
MyISAMstorage engine, 25% of the machine's total memory is an acceptable value for this variable. However, you should be aware that, if you make the value too large (for example, more than 50% of the machine's total memory), your system might start to page and become extremely slow. This is because MySQL relies on the operating system to perform file system caching for data reads, so you must leave some room for the file system cache. You should also consider the memory requirements of any other storage engines that you may be using in addition toMyISAM.For even more speed when writing many rows at the same time, use
LOCK TABLES. See Section 8.2.5.1, “Optimizing INSERT Statements”.You can check the performance of the key buffer by issuing a
SHOW STATUSstatement and examining theKey_read_requests,Key_reads,Key_write_requests, andKey_writesstatus variables. (See Section 13.7.5, “SHOW Syntax”.) TheKey_reads/Key_read_requestsratio should normally be less than 0.01. TheKey_writes/Key_write_requestsratio is usually near 1 if you are using mostly updates and deletes, but might be much smaller if you tend to do updates that affect many rows at the same time or if you are using theDELAY_KEY_WRITEtable option.The fraction of the key buffer in use can be determined using
key_buffer_sizein conjunction with theKey_blocks_unusedstatus variable and the buffer block size, which is available from thekey_cache_block_sizesystem variable:1 - ((Key_blocks_unused * key_cache_block_size) / key_buffer_size)This value is an approximation because some space in the key buffer is allocated internally for administrative structures. Factors that influence the amount of overhead for these structures include block size and pointer size. As block size increases, the percentage of the key buffer lost to overhead tends to decrease. Larger blocks results in a smaller number of read operations (because more keys are obtained per read), but conversely an increase in reads of keys that are not examined (if not all keys in a block are relevant to a query).
It is possible to create multiple
MyISAMkey caches. The size limit of 4GB applies to each cache individually, not as a group. See Section 8.10.2, “The MyISAM Key Cache”. -
Command-Line Format --key-cache-age-threshold=#System Variable Name key_cache_age_thresholdVariable Scope Global Dynamic Variable Yes Permitted Values (32-bit platforms) Type integer Default 300Min Value 100Max Value 4294967295Permitted Values (64-bit platforms) Type integer Default 300Min Value 100Max Value 18446744073709551615This value controls the demotion of buffers from the hot sublist of a key cache to the warm sublist. Lower values cause demotion to happen more quickly. The minimum value is 100. The default value is 300. See Section 8.10.2, “The MyISAM Key Cache”.
-
Command-Line Format --key-cache-block-size=#System Variable Name key_cache_block_sizeVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default 1024Min Value 512Max Value 16384The size in bytes of blocks in the key cache. The default value is 1024. See Section 8.10.2, “The MyISAM Key Cache”.
-
Command-Line Format --key-cache-division-limit=#System Variable Name key_cache_division_limitVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default 100Min Value 1Max Value 100The division point between the hot and warm sublists of the key cache buffer list. The value is the percentage of the buffer list to use for the warm sublist. Permissible values range from 1 to 100. The default value is 100. See Section 8.10.2, “The MyISAM Key Cache”.
-
System Variable Name large_files_supportVariable Scope Global Dynamic Variable No Whether mysqld was compiled with options for large file support.
-
Command-Line Format --large-pagesSystem Variable Name large_pagesVariable Scope Global Dynamic Variable No Platform Specific Linux Permitted Values (Linux) Type boolean Default FALSEWhether large page support is enabled (via the
--large-pagesoption). See Section 8.12.3.2, “Enabling Large Page Support”. -
System Variable Name large_page_sizeVariable Scope Global Dynamic Variable No Permitted Values (Linux) Type integer Default 0If large page support is enabled, this shows the size of memory pages. Large memory pages are supported only on Linux; on other platforms, the value of this variable is always 0. See Section 8.12.3.2, “Enabling Large Page Support”.
The value to be returned from
LAST_INSERT_ID(). This is stored in the binary log when you useLAST_INSERT_ID()in a statement that updates a table. Setting this variable does not update the value returned by themysql_insert_id()C API function.-
Command-Line Format --lc-messages=nameSystem Variable Name lc_messagesVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type string Default en_USThe locale to use for error messages. The default is
en_US. The server converts the argument to a language name and combines it with the value oflc_messages_dirto produce the location for the error message file. See Section 10.2, “Setting the Error Message Language”. -
Command-Line Format --lc-messages-dir=dir_nameSystem Variable Name lc_messages_dirVariable Scope Global Dynamic Variable No Permitted Values Type directory name The directory where error messages are located. The server uses the value together with the value of
lc_messagesto produce the location for the error message file. See Section 10.2, “Setting the Error Message Language”. -
System Variable Name lc_time_namesVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type string This variable specifies the locale that controls the language used to display day and month names and abbreviations. This variable affects the output from the
DATE_FORMAT(),DAYNAME()andMONTHNAME()functions. Locale names are POSIX-style values such as'ja_JP'or'pt_BR'. The default value is'en_US'regardless of your system's locale setting. For further information, see Section 10.7, “MySQL Server Locale Support”. -
System Variable Name licenseVariable Scope Global Dynamic Variable No Permitted Values Type string Default GPLThe type of license the server has.
-
System Variable Name local_infileVariable Scope Global Dynamic Variable Yes Permitted Values (<= 8.0.1) Type boolean Default ONPermitted Values (>= 8.0.2) Type boolean Default OFFThis variable controls server-side
LOCALcapability forLOAD DATAstatements. Depending on thelocal_infilesetting, the server refuses or permits local data loading by clients that haveLOCALenabled on the client side.To explicitly cause the server to refuse or permit
LOAD DATA LOCALstatements (regardless of how client programs and libraries are configured at build time or runtime), start mysqld withlocal_infiledisabled or enabled, respectively.local_infilecan also be set at runtime. For more information, see Section 6.1.6, “Security Issues with LOAD DATA LOCAL”. -
Command-Line Format --lock-wait-timeout=#System Variable Name lock_wait_timeoutVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default 31536000Min Value 1Max Value 31536000This 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.
This timeout applies to all statements that use metadata locks. These include DML and DDL operations on tables, views, stored procedures, and stored functions, as well as
LOCK TABLES,FLUSH TABLES WITH READ LOCK, andHANDLERstatements.This timeout does not apply to implicit accesses to system tables in the
mysqldatabase, such as grant tables modified byGRANTorREVOKEstatements or table logging statements. The timeout does apply to system tables accessed directly, such as withSELECTorUPDATE.The timeout value applies separately for each metadata lock attempt. A given statement can require more than one lock, so it is possible for the statement to block for longer than the
lock_wait_timeoutvalue before reporting a timeout error. When lock timeout occurs,ER_LOCK_WAIT_TIMEOUTis reported.lock_wait_timeoutdoes not apply to delayed inserts, which always execute with a timeout of 1 year. This is done to avoid unnecessary timeouts because a session that issues a delayed insert receives no notification of delayed insert timeouts. -
System Variable Name locked_in_memoryVariable Scope Global Dynamic Variable No log_bin_trust_function_creatorsCommand-Line Format --log-bin-trust-function-creatorsSystem Variable Name log_bin_trust_function_creatorsVariable Scope Global Dynamic Variable Yes Permitted Values Type boolean Default FALSEThis 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
SUPERprivilege in addition to theCREATE ROUTINEorALTER ROUTINEprivilege. A setting of 0 also enforces the restriction that a function must be declared with theDETERMINISTICcharacteristic, or with theREADS SQL DATAorNO SQLcharacteristic. If the variable is set to 1, MySQL does not enforce these restrictions on stored function creation. This variable also applies to trigger creation. See Section 23.7, “Binary Logging of Stored Programs”.log_builtin_as_identified_by_passwordCommand-Line Format --log-builtin-as-identified-by-password[={OFF|ON}]System Variable Name log_builtin_as_identified_by_passwordVariable Scope Global Dynamic Variable Yes Permitted Values Type boolean Default OFFThis variable affects binary logging of user-management statements. If enabled, binary logging for
CREATE USERstatements involving built-in authentication plugins rewrites the statements to include anIDENTIFIED BY PASSWORDclause, andSET PASSWORDstatements are logged asSET PASSWORDstatements, rather than being rewritten toALTER USERstatements.-
Command-Line Format --log-error[=file_name]System Variable Name log_errorVariable Scope Global Dynamic Variable No Permitted Values Type file name The location of the error log, or
stderrif the server is writing error message to the standard error output. See Section 5.4.2, “The Error Log”. -
Introduced 8.0.2 Command-Line Format --log-error-filter-rulesSystem Variable Name log_error_filter_rulesVariable Scope Global Dynamic Variable Yes Permitted Values Type string Default set by serverThe filter rules for error logging.
-
Introduced 8.0.2 Command-Line Format --log-error-servicesSystem Variable Name log_error_servicesVariable Scope Global Dynamic Variable Yes Permitted Values Type string Default log_filter_internal; log_sink_internalThe components to use for error logging.
-
Command-Line Format --log-error-verbosity=#System Variable Name log_error_verbosityVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default 3Min Value 1Max Value 3This variable controls verbosity of the server in writing error, warning, and note messages to the error log. The following table shows the permitted values. The default is 3.
Verbosity Value Message Types Logged 1 Errors only 2 Errors and warnings 3 Errors, warnings, and notes log_error_verbosityis preferred over, and should be used instead of, the olderlog_warningssystem variable. See the description oflog_warningsfor information about how that variable relates tolog_error_verbosity. In particular, assigning a value tolog_warningsassigns a value tolog_error_verbosityand vice versa. -
Command-Line Format --log-output=nameSystem Variable Name log_outputVariable Scope Global Dynamic Variable Yes Permitted Values Type set Default FILEValid Values TABLEFILENONEThe destination for general query log and slow query log output. The value can be a comma-separated list of one or more of the words
TABLE(log to tables),FILE(log to files), orNONE(do not log to tables or files). The default value isFILE.NONE, if present, takes precedence over any other specifiers. If the value isNONElog entries are not written even if the logs are enabled. If the logs are not enabled, no logging occurs even if the value oflog_outputis notNONE. For more information, see Section 5.4.1, “Selecting General Query and Slow Query Log Output Destinations”. -
Command-Line Format --log-queries-not-using-indexesSystem Variable Name log_queries_not_using_indexesVariable Scope Global Dynamic Variable Yes Permitted Values Type boolean Default OFFWhether queries that do not use indexes are logged to the slow query log. See Section 5.4.5, “The Slow Query Log”.
-
Command-Line Format --log-syslog[={0|1}]System Variable Name log_syslogVariable Scope Global Dynamic Variable Yes Permitted Values (Unix) Type boolean Default OFFPermitted Values (Windows) Type boolean Default ONWhether to write error log output to
syslog(on Unix and Unix-like systems) or Event Log (on Windows). The default value is platform specific:On Unix and Unix-like systems,
syslogoutput is disabled by default.On Windows, Event Log output is enabled by default, which is consistent with older MySQL versions.
Regardless of the default,
log_syslogcan be set explicitly to control output on any supported platform.syslogoutput control is distinct from to sending error output to a file or (on Windows) to the console. Error output can be directed to the latter destination in addition to or instead ofsyslogas desired. See Section 5.4.2, “The Error Log”. -
Command-Line Format --log-syslog-facility=valueSystem Variable Name log_syslog_facilityVariable Scope Global Dynamic Variable Yes Permitted Values Type string Default daemonThe facility for error log output written to
syslog(what type of program is sending the message). This variable has no effect unless thelog_syslogsystem variable is enabled. See Section 5.4.2, “The Error Log”.The permitted values can vary per operating system; consult your system
syslogdocumentation.This variable does not exist on Windows.
-
Command-Line Format --log-syslog-include-pid[={0|1}]System Variable Name log_syslog_include_pidVariable Scope Global Dynamic Variable Yes Permitted Values Type boolean Default ONWhether to include the server process ID in each line of error log output written to
syslog. This variable has no effect unless thelog_syslogsystem variable is enabled. See Section 5.4.2, “The Error Log”.This variable does not exist on Windows.
-
Command-Line Format --log-syslog-tag=valueSystem Variable Name log_syslog_tagVariable Scope Global Dynamic Variable Yes Permitted Values Type string Default empty stringThe tag to be added to the server identifier in error log output written to
syslog. This variable has no effect unless thelog_syslogsystem variable is enabled. See Section 5.4.2, “The Error Log”.By default, the server identifier is
mysqldwith no tag. If a tag oftag_valis specified, it is appended to the server identifier with a leading hyphen, resulting in an identifier ofmysqld-.tag_valOn Windows, to use a tag that does not already exist, the server must be run from an account with Administrator privileges, to permit creation of a registry entry for the tag. Elevated privileges are not required if the tag already exists.
-
Command-Line Format --log-timestamps=#System Variable Name log_timestampsVariable Scope Global Dynamic Variable Yes Permitted Values Type enumeration Default UTCValid Values UTCSYSTEMThis variable controls the timestamp time zone of error log messages, and of general query log and slow query log messages written to files. It does not affect the time zone of general query log and slow query log messages written to tables (
mysql.general_log,mysql.slow_log). Rows retrieved from those tables can be converted from the local system time zone to any desired time zone withCONVERT_TZ()or by setting the sessiontime_zonesystem variable.Permitted
log_timestampsvalues areUTC(the default) andSYSTEM(local system time zone).Timestamps are written using ISO 8601 / RFC 3339 format:
YYYY-MM-DDThh:mm:ss.uuuuuuplus a tail value ofZsignifying Zulu time (UTC) or±hh:mm(an offset from UTC). log_throttle_queries_not_using_indexesSystem Variable Name log_throttle_queries_not_using_indexesVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default 0If
log_queries_not_using_indexesis enabled, thelog_throttle_queries_not_using_indexesvariable limits the number of such queries per minute that can be written to the slow query log. A value of 0 (the default) means “no limit”. For more information, see Section 5.4.5, “The Slow Query Log”.-
System Variable Name log_slow_admin_statementsVariable Scope Global Dynamic Variable Yes Permitted Values Type boolean Default OFFInclude slow administrative statements in the statements written to the slow query log. Administrative statements include
ALTER TABLE,ANALYZE TABLE,CHECK TABLE,CREATE INDEX,DROP INDEX,OPTIMIZE TABLE, andREPAIR TABLE. -
Deprecated 5.7.2 Command-Line Format --log-warnings[=#]System Variable Name log_warningsVariable Scope Global Dynamic Variable Yes Permitted Values (32-bit platforms) Type integer Default 2Min Value 0Max Value 4294967295Permitted Values (64-bit platforms) Type integer Default 2Min Value 0Max Value 18446744073709551615Whether to produce additional warning messages to the error log. This variable is enabled by default with a value of 2. To disable it, set it to 0. The server logs messages about statements that are unsafe for statement-based logging if the value is greater than 0. Aborted connections and access-denied errors for new connection attempts are logged if the value is greater than 1. See Section B.5.2.10, “Communication Errors and Aborted Connections”.
Enabling this option by setting it greater than 0 is recommended, if you use replication, to get more information about what is happening, such as messages about network failures and reconnections. If the value is greater than 1, aborted connections are written to the error log, and access-denied errors for new connection attempts are written.
If a slave server is started with
log_warningsenabled, the slave prints messages to the error log to provide information about its status, such as the binary log and relay log coordinates where it starts its job, when it is switching to another relay log, when it reconnects after a disconnect, and so forth.As of MySQL 5.7.2, information items previously governed by
log_warningsare governed bylog_error_verbosity, which is preferred over, and should be used instead of, the olderlog_warningssystem variable. (Thelog_warningssystem variable and--log-warningscommand-line option are deprecated and will be removed in a future MySQL release.)Assigning a value to
log_warningsassigns a value tolog_error_verbosityand vice versa. The variables are related as follows:Suppression of all
log_warningsitems, achieved withlog_warnings=0, is achieved withlog_error_verbosity=1(errors only).Items printed for
log_warnings=1or higher count as warnings and are printed forlog_error_verbosity=2or higher.Items printed for
log_warnings=2count as notes and are printed forlog_error_verbosity=3.
As of MySQL 5.7.2, the default log level is controlled by
log_error_verbosity, which has a default of 3. In addition, the default forlog_warningschanges from 1 to 2, which corresponds tolog_error_verbosity=3. To achieve a logging level similar to the previous default, setlog_error_verbosity=2.In MySQL 5.7.2 and higher, use of
log_warningsis still permitted but maps onto use oflog_error_verbosityas follows:Setting
log_warnings=0is equivalent tolog_error_verbosity=1(errors only).Setting
log_warnings=1is equivalent tolog_error_verbosity=2(errors, warnings).Setting
log_warnings=2(or higher) is equivalent tolog_error_verbosity=3(errors, warnings, notes), and the server setslog_warningsto 2 if a larger value is specified.
-
Command-Line Format --long-query-time=#System Variable Name long_query_timeVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type numeric Default 10Min Value 0If a query takes longer than this many seconds, the server increments the
Slow_queriesstatus variable. If the slow query log is enabled, the query is logged to the slow query log file. This value is measured in real time, not CPU time, so a query that is under the threshold on a lightly loaded system might be above the threshold on a heavily loaded one. The minimum and default values oflong_query_timeare 0 and 10, respectively. The value can be specified to a resolution of microseconds. For logging to a file, times are written including the microseconds part. For logging to tables, only integer times are written; the microseconds part is ignored. See Section 5.4.5, “The Slow Query Log”. -
Command-Line Format --low-priority-updatesSystem Variable Name low_priority_updatesVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type boolean Default FALSEIf set to
1, allINSERT,UPDATE,DELETE, andLOCK TABLE WRITEstatements wait until there is no pendingSELECTorLOCK TABLE READon the affected table. This affects only storage engines that use only table-level locking (such asMyISAM,MEMORY, andMERGE). -
System Variable Name lower_case_file_systemVariable Scope Global Dynamic Variable No Permitted Values Type boolean This variable describes the case sensitivity of file names on the file system where the data directory is located.
OFFmeans file names are case sensitive,ONmeans they are not case sensitive. This variable is read only because it reflects a file system attribute and setting it would have no effect on the file system. -
Command-Line Format --lower-case-table-names[=#]System Variable Name lower_case_table_namesVariable Scope Global Dynamic Variable No Permitted Values Type integer Default 0Min Value 0Max Value 2If set to 0, table names are stored as specified and comparisons are case sensitive. If set to 1, table names are stored in lowercase on disk and comparisons are not case sensitive. If set to 2, table names are stored as given but compared in lowercase. This option also applies to database names and table aliases. For additional information, see Section 9.2.2, “Identifier Case Sensitivity”.
On Windows the default value is 1. On OS X, the default value is 2.
You should not set
lower_case_table_namesto 0 if you are running MySQL on a system where the data directory resides on a case-insensitive file system (such as on Windows or OS X). It is an unsupported combination that could result in a hang condition when running anINSERT INTO ... SELECT ... FROMoperation with the wrongtbl_nametbl_nameletter case. WithMyISAM, accessing table names using different letter cases could cause index corruption.As of MySQL 5.7.9, an error message is printed and the server exits if you attempt to start the server with
--lower_case_table_names=0on a case-insensitive file system.If you are using
InnoDBtables, you should set this variable to 1 on all platforms to force names to be converted to lowercase.The setting of this variable in MySQL 8.0 affects the behavior of replication filtering options with regard to case sensitivity. (Bug #51639) See Section 18.2.5, “How Servers Evaluate Replication Filtering Rules”, for more information.
-
Introduced 8.0.2 Command-Line Format --mandatory-rolesSystem Variable Name mandatory_rolesVariable Scope Global Dynamic Variable Yes Permitted Values Type string Default empty stringRoles the server should treat as mandatory. In effect, these roles are automatically granted to every user, although setting
mandatory_rolesdoes not actually change any user accounts, and the granted roles are not visible in themysql.role_edgessystem table.The variable value is a comma-separated list of role names. Example:
SET PERSIST mandatory_roles = '`role1`@`%`,`role2`,role3,role4@localhost';Role names consist of a user part and host part in
'format. The host part, if omitted, defaults touser_name'@'host_name''%'. For additional information, see Section 6.2.5, “Specifying Role Names”.Any role named in the value of
mandatory_rolescannot be revoked withREVOKEor dropped withDROP ROLEorDROP USER.Mandatory roles, like explicitly granted roles, do not take effect until activated. Activation occurs at login time if the
activate_all_roles_on_loginsystem variable is enabled or for roles that are set as default roles. Otherwise,SET ROLEactivates roles at runtime.Roles that do not exist when assigned to
mandatory_rolesbut are created later may require special treatment to be considered mandatory. For details, see Defining Mandatory Roles.SHOW GRANTSdisplays mandatory roles according to the rules described in Section 13.7.5.21, “SHOW GRANTS Syntax”. -
Command-Line Format --max-allowed-packet=#System Variable Name max_allowed_packetVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default 4194304Min Value 1024Max Value 1073741824The maximum size of one packet or any generated/intermediate string, or any parameter sent by the
mysql_stmt_send_long_data()C API function. The default is 4MB.The packet message buffer is initialized to
net_buffer_lengthbytes, but can grow up tomax_allowed_packetbytes when needed. This value by default is small, to catch large (possibly incorrect) packets.You must increase this value if you are using large
BLOBcolumns or long strings. It should be as big as the largestBLOByou want to use. The protocol limit formax_allowed_packetis 1GB. The value should be a multiple of 1024; nonmultiples are rounded down to the nearest multiple.When you change the message buffer size by changing the value of the
max_allowed_packetvariable, you should also change the buffer size on the client side if your client program permits it. The defaultmax_allowed_packetvalue built in to the client library is 1GB, but individual client programs might override this. For example, mysql and mysqldump have defaults of 16MB and 24MB, respectively. They also enable you to change the client-side value by settingmax_allowed_packeton the command line or in an option file.The session value of this variable is read only. The client can receive up to as many bytes as the session value. However, the server will not send to the client more bytes than the current global
max_allowed_packetvalue. (The global value could be less than the session value if the global value is changed after the client connects.) -
Command-Line Format --max-connect-errors=#System Variable Name max_connect_errorsVariable Scope Global Dynamic Variable Yes Permitted Values (32-bit platforms) Type integer Default 100Min Value 1Max Value 4294967295Permitted Values (64-bit platforms) Type integer Default 100Min Value 1Max Value 18446744073709551615If more than this many successive connection requests from a host are interrupted without a successful connection, the server blocks that host from further connections. You can unblock blocked hosts by flushing the host cache. To do so, issue a
FLUSH HOSTSstatement or execute a mysqladmin flush-hosts command. If a connection is established successfully within fewer thanmax_connect_errorsattempts after a previous connection was interrupted, the error count for the host is cleared to zero. However, once a host is blocked, flushing the host cache is the only way to unblock it. The default is 100. -
Command-Line Format --max-connections=#System Variable Name max_connectionsVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default 151Min Value 1Max Value 100000The maximum permitted number of simultaneous client connections. By default, this is 151. See Section B.5.2.6, “Too many connections”, for more information.
Increasing this value increases the number of file descriptors that mysqld requires. If the required number of descriptors are not available, the server reduces the value of
max_connections. See Section 8.4.3.1, “How MySQL Opens and Closes Tables”, for comments on file descriptor limits.mysqld actually permits
max_connections+1clients to connect. The extra connection is reserved for use by accounts that have theSUPERprivilege. By granting theSUPERprivilege to administrators and not to normal users (who should not need it), an administrator can connect to the server and useSHOW PROCESSLISTto diagnose problems even if the maximum number of unprivileged clients are connected. See Section 13.7.5.29, “SHOW PROCESSLIST Syntax”.Connections refused because the
max_connectionslimit is reached increment theConnection_errors_max_connectionsstatus variable. -
Deprecated 5.6.7 Command-Line Format --max-delayed-threads=#System Variable Name max_delayed_threadsVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default 20Min Value 0Max Value 16384This system variable is deprecated (because
DELAYEDinserts are not supported), and will be removed in a future release. -
Command-Line Format --max-digest-length=#System Variable Name max_digest_lengthVariable Scope Global Dynamic Variable No Permitted Values Type integer Default 1024Min Value 0Max Value 1048576The maximum number of bytes available for computing normalized statement digests. Once that amount of space is used during digest computation, truncation occurs: no further tokens from a parsed statement are collected or figure into its digest value. Statements that differ only after that many bytes of parsed tokens produce the same normalized statement digest and are considered identical if compared or if aggregated for digest statistics.
Decreasing the
max_digest_lengthvalue reduces memory use but causes the digest value of more statements to become indistinguishable if they differ only at the end. Increasing the value permits longer statements to be distinguished but increases memory use, particularly for workloads that involve large numbers of simultaneous sessions (the server allocatesmax_digest_lengthbytes per session).The parser uses this system variable as a limit on the maximum length of normalized statement digests that it computes. The Performance Schema, if it tracks statement digests, makes a copy of the digest value, using the
performance_schema_max_digest_length. system variable as a limit on the maximum length of digests that it stores. Consequently, ifperformance_schema_max_digest_lengthis less thanmax_digest_length, digest values stored in the Performance Schema are truncated relative to the original digest values.For more information about statement digesting, see Section 25.9, “Performance Schema Statement Digests”.
-
Command-Line Format --max-error-count=#System Variable Name max_error_countVariable Scope Global, Session Dynamic Variable Yes Permitted Values (<= 8.0.2) Type integer Default 64Min Value 0Max Value 65535Permitted Values (>= 8.0.3) Type integer Default 1024Min Value 0Max Value 65535The maximum number of error, warning, and note messages to be stored for display by the
SHOW ERRORSandSHOW WARNINGSstatements. This is the same as the number of condition areas in the diagnostics area, and thus the number of conditions that can be inspected byGET DIAGNOSTICS. -
Command-Line Format --max-execution-time=#System Variable Name max_execution_timeVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default 0The execution timeout for
SELECTstatements, in milliseconds. If the value is 0, timeouts are not enabled.max_execution_timeapplies as follows:The global
max_execution_timevalue provides the default for the session value for new connections. The session value applies toSELECTexecutions executed within the session that include noMAX_EXECUTION_TIME(optimizer hint or for whichN)Nis 0.max_execution_timeapplies to read-onlySELECTstatements. Statements that are not read only are those that invoke a stored function that modifies data as a side effect.max_execution_timeis ignored forSELECTstatements in stored programs.
-
Command-Line Format --max-heap-table-size=#System Variable Name max_heap_table_sizeVariable Scope Global, Session Dynamic Variable Yes Permitted Values (32-bit platforms) Type integer Default 16777216Min Value 16384Max Value 4294967295Permitted Values (64-bit platforms) Type integer Default 16777216Min Value 16384Max Value 1844674407370954752This variable sets the maximum size to which user-created
MEMORYtables are permitted to grow. The value of the variable is used to calculateMEMORYtableMAX_ROWSvalues. Setting this variable has no effect on any existingMEMORYtable, unless the table is re-created with a statement such asCREATE TABLEor altered withALTER TABLEorTRUNCATE TABLE. A server restart also sets the maximum size of existingMEMORYtables to the globalmax_heap_table_sizevalue.This variable is also used in conjunction with
tmp_table_sizeto limit the size of internal in-memory tables. See Section 8.4.4, “Internal Temporary Table Use in MySQL”.max_heap_table_sizeis not replicated. See Section 18.4.1.23, “Replication and MEMORY Tables”, and Section 18.4.1.38, “Replication and Variables”, for more information. -
Deprecated 5.6.7 System Variable Name max_insert_delayed_threadsVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer This variable is a synonym for
max_delayed_threads.This system variable is deprecated (because
DELAYEDinserts are not supported), and will be removed in a future release. -
Command-Line Format --max-join-size=#System Variable Name max_join_sizeVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default 18446744073709551615Min Value 1Max Value 18446744073709551615Do not permit statements that probably need to examine more than
max_join_sizerows (for single-table statements) or row combinations (for multiple-table statements) or that are likely to do more thanmax_join_sizedisk seeks. By setting this value, you can catch statements where keys are not used properly and that would probably take a long time. Set it if your users tend to perform joins that lack aWHEREclause, that take a long time, or that return millions of rows.Setting this variable to a value other than
DEFAULTresets the value ofsql_big_selectsto0. If you set thesql_big_selectsvalue again, themax_join_sizevariable is ignored.If a query result is in the query cache, no result size check is performed, because the result has previously been computed and it does not burden the server to send it to the client.
-
Command-Line Format --max-length-for-sort-data=#System Variable Name max_length_for_sort_dataVariable Scope Global, Session Dynamic Variable Yes Permitted Values (8.0.0) Type integer Default 1024Min Value 4Max Value 8388608Permitted Values (>= 8.0.1) Type integer Default 4096Min Value 4Max Value 8388608The cutoff on the size of index values that determines which
filesortalgorithm to use. See Section 8.2.1.13, “ORDER BY Optimization”. -
Command-Line Format --max-points-in-geometry=integerSystem Variable Name max_points_in_geometryVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default 65536Min Value 3Max Value 1048576The maximum value of the
points_per_circleargument to theST_Buffer_Strategy()function. -
Command-Line Format --max-prepared-stmt-count=#System Variable Name max_prepared_stmt_countVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default 16382Min Value 0Max Value 1048576This variable limits the total number of prepared statements in the server. It can be used in environments where there is the potential for denial-of-service attacks based on running the server out of memory by preparing huge numbers of statements. If the value is set lower than the current number of prepared statements, existing statements are not affected and can be used, but no new statements can be prepared until the current number drops below the limit. The default value is 16,382. The permissible range of values is from 0 to 1 million. Setting the value to 0 disables prepared statements.
-
Command-Line Format --max-relay-log-size=#System Variable Name max_relay_log_sizeVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default 0Min Value 0Max Value 1073741824If a write by a replication slave to its relay log causes the current log file size to exceed the value of this variable, the slave rotates the relay logs (closes the current file and opens the next one). If
max_relay_log_sizeis 0, the server usesmax_binlog_sizefor both the binary log and the relay log. Ifmax_relay_log_sizeis greater than 0, it constrains the size of the relay log, which enables you to have different sizes for the two logs. You must setmax_relay_log_sizeto between 4096 bytes and 1GB (inclusive), or to 0. The default value is 0. See Section 18.2.2, “Replication Implementation Details”. -
Command-Line Format --max-seeks-for-key=#System Variable Name max_seeks_for_keyVariable Scope Global, Session Dynamic Variable Yes Permitted Values (32-bit platforms) Type integer Default 4294967295Min Value 1Max Value 4294967295Permitted Values (64-bit platforms) Type integer Default 18446744073709551615Min Value 1Max Value 18446744073709551615Limit the assumed maximum number of seeks when looking up rows based on a key. The MySQL optimizer assumes that no more than this number of key seeks are required when searching for matching rows in a table by scanning an index, regardless of the actual cardinality of the index (see Section 13.7.5.22, “SHOW INDEX Syntax”). By setting this to a low value (say, 100), you can force MySQL to prefer indexes instead of table scans.
-
Command-Line Format --max-sort-length=#System Variable Name max_sort_lengthVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default 1024Min Value 4Max Value 8388608The number of bytes to use when sorting data values. The server uses only the first
max_sort_lengthbytes of each value and ignores the rest. Consequently, values that differ only after the firstmax_sort_lengthbytes compare as equal forGROUP BY,ORDER BY, andDISTINCToperations.Increasing the value of
max_sort_lengthmay require increasing the value ofsort_buffer_sizeas well. For details, see Section 8.2.1.13, “ORDER BY Optimization” -
Command-Line Format --max-sp-recursion-depth[=#]System Variable Name max_sp_recursion_depthVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default 0Max Value 255The number of times that any given stored procedure may be called recursively. The default value for this option is 0, which completely disables recursion in stored procedures. The maximum value is 255.
Stored procedure recursion increases the demand on thread stack space. If you increase the value of
max_sp_recursion_depth, it may be necessary to increase thread stack size by increasing the value ofthread_stackat server startup. This variable is unused. It is deprecated and will be removed in a future MySQL release.
-
Command-Line Format --max-user-connections=#System Variable Name max_user_connectionsVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default 0Min Value 0Max Value 4294967295The maximum number of simultaneous connections permitted to any given MySQL user account. A value of 0 (the default) means “no limit.”
This variable has a global value that can be set at server startup or runtime. It also has a read-only session value that indicates the effective simultaneous-connection limit that applies to the account associated with the current session. The session value is initialized as follows:
If the user account has a nonzero
MAX_USER_CONNECTIONSresource limit, the sessionmax_user_connectionsvalue is set to that limit.Otherwise, the session
max_user_connectionsvalue is set to the global value.
Account resource limits are specified using the
CREATE USERorALTER USERstatement. See Section 6.3.6, “Setting Account Resource Limits”. -
Command-Line Format --max-write-lock-count=#System Variable Name max_write_lock_countVariable Scope Global Dynamic Variable Yes Permitted Values (32-bit platforms) Type integer Default 4294967295Min Value 1Max Value 4294967295Permitted Values (64-bit platforms) Type integer Default 18446744073709551615Min Value 1Max Value 18446744073709551615After this many write locks, permit some pending read lock requests to be processed in between.
-
Command-Line Format --mecab-rc-fileSystem Variable Name mecab_rc_fileVariable Scope Global Dynamic Variable No Permitted Values Type directory name The
mecab_rc_fileoption is used when setting up the MeCab full-text parser.The
mecab_rc_fileoption defines the path to themecabrcconfiguration file, which is the configuration file for MeCab. The option is read-only and can only be set at startup. Themecabrcconfiguration file is required to initialize MeCab.For information about the MeCab full-text parser, see Section 12.9.9, “MeCab Full-Text Parser Plugin”.
For information about options that can be specified in the MeCab
mecabrcconfiguration file, refer to the MeCab Documentation on the Google Developers site. -
Deprecated 5.7.4 System Variable Name metadata_locks_cache_sizeVariable Scope Global Dynamic Variable No Permitted Values Type integer Default 1024Min Value 1Max Value 1048576The size of the metadata locks cache. The server uses this cache to avoid creation and destruction of synchronization objects. This is particularly helpful on systems where such operations are expensive, such as Windows XP.
Metadata locking implementation changes have made this variable unnecessary, so it is deprecated and will be removed in a future MySQL release.
-
Deprecated 5.7.4 System Variable Name metadata_locks_hash_instancesVariable Scope Global Dynamic Variable No Permitted Values Type integer Default 8Min Value 1Max Value 1024The set of metadata locks can be partitioned into separate hashes to permit connections accessing different objects to use different locking hashes and reduce contention. The
metadata_locks_hash_instancessystem variable specifies the number of hashes (default 8).Metadata locking implementation changes have made this variable unnecessary, so it is deprecated and will be removed in a future MySQL release.
-
Command-Line Format --min-examined-row-limit=#System Variable Name min_examined_row_limitVariable Scope Global, Session Dynamic Variable Yes Permitted Values (32-bit platforms) Type integer Default 0Min Value 0Max Value 4294967295Permitted Values (64-bit platforms) Type integer Default 0Min Value 0Max Value 18446744073709551615Queries that examine fewer than this number of rows are not logged to the slow query log.
-
Deprecated 5.6.7 Command-Line Format --multi-range-count=#System Variable Name multi_range_countVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default 256Min Value 1Max Value 4294967295This variable has no effect. It is deprecated and will be removed in a future MySQL release.
-
Command-Line Format --myisam-data-pointer-size=#System Variable Name myisam_data_pointer_sizeVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default 6Min Value 2Max Value 7The default pointer size in bytes, to be used by
CREATE TABLEforMyISAMtables when noMAX_ROWSoption is specified. This variable cannot be less than 2 or larger than 7. The default value is 6. See Section B.5.2.11, “The table is full”. -
Command-Line Format --myisam-max-sort-file-size=#System Variable Name myisam_max_sort_file_sizeVariable Scope Global Dynamic Variable Yes Permitted Values (32-bit platforms) Type integer Default 2147483648Permitted Values (64-bit platforms) Type integer Default 9223372036854775807The maximum size of the temporary file that MySQL is permitted to use while re-creating a
MyISAMindex (duringREPAIR TABLE,ALTER TABLE, orLOAD DATA INFILE). If the file size would be larger than this value, the index is created using the key cache instead, which is slower. The value is given in bytes.If
MyISAMindex files exceed this size and disk space is available, increasing the value may help performance. The space must be available in the file system containing the directory where the original index file is located. -
Command-Line Format --myisam-mmap-size=#System Variable Name myisam_mmap_sizeVariable Scope Global Dynamic Variable No Permitted Values (32-bit platforms) Type integer Default 4294967295Min Value 7Max Value 4294967295Permitted Values (64-bit platforms) Type integer Default 18446744073709551615Min Value 7Max Value 18446744073709551615The maximum amount of memory to use for memory mapping compressed
MyISAMfiles. If many compressedMyISAMtables are used, the value can be decreased to reduce the likelihood of memory-swapping problems. -
System Variable Name myisam_recover_optionsVariable Scope Global Dynamic Variable No The value of the
--myisam-recover-optionsoption. See Section 5.1.4, “Server Command Options”. -
Command-Line Format --myisam-repair-threads=#System Variable Name myisam_repair_threadsVariable Scope Global, Session Dynamic Variable Yes Permitted Values (32-bit platforms) Type integer Default 1Min Value 1Max Value 4294967295Permitted Values (64-bit platforms) Type integer Default 1Min Value 1Max Value 18446744073709551615If this value is greater than 1,
MyISAMtable indexes are created in parallel (each index in its own thread) during theRepair by sortingprocess. The default value is 1.NoteMulti-threaded repair is still beta-quality code.
-
Command-Line Format --myisam-sort-buffer-size=#System Variable Name myisam_sort_buffer_sizeVariable Scope Global, Session Dynamic Variable Yes Permitted Values (Windows, 32-bit platforms) Type integer Default 8388608Min Value 4096Max Value 4294967295Permitted Values (Windows, 64-bit platforms) Type integer Default 8388608Min Value 4096Max Value 18446744073709551615Permitted Values (Other, 32-bit platforms) Type integer Default 8388608Min Value 4096Max Value 4294967295Permitted Values (Other, 64-bit platforms) Type integer Default 8388608Min Value 4096Max Value 18446744073709551615The size of the buffer that is allocated when sorting
MyISAMindexes during aREPAIR TABLEor when creating indexes withCREATE INDEXorALTER TABLE.The maximum permissible setting for
myisam_sort_buffer_sizeis 4GB−1. Larger values are permitted for 64-bit platforms. -
Command-Line Format --myisam-stats-method=nameSystem Variable Name myisam_stats_methodVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type enumeration Default nulls_unequalValid Values nulls_equalnulls_unequalnulls_ignoredHow the server treats
NULLvalues when collecting statistics about the distribution of index values forMyISAMtables. This variable has three possible values,nulls_equal,nulls_unequal, andnulls_ignored. Fornulls_equal, allNULLindex values are considered equal and form a single value group that has a size equal to the number ofNULLvalues. Fornulls_unequal,NULLvalues are considered unequal, and eachNULLforms a distinct value group of size 1. Fornulls_ignored,NULLvalues are ignored.The method that is used for generating table statistics influences how the optimizer chooses indexes for query execution, as described in Section 8.3.7, “InnoDB and MyISAM Index Statistics Collection”.
-
Command-Line Format --myisam-use-mmapSystem Variable Name myisam_use_mmapVariable Scope Global Dynamic Variable Yes Permitted Values Type boolean Default OFFUse memory mapping for reading and writing
MyISAMtables. mysql_native_password_proxy_usersCommand-Line Format --mysql-native-password-proxy-users=[={OFF|ON}]System Variable Name mysql_native_password_proxy_usersVariable Scope Global Dynamic Variable Yes Permitted Values Type boolean Default OFFThis variable controls whether the
mysql_native_passwordbuilt-in authentication plugin supports proxy users. It has no effect unless thecheck_proxy_userssystem variable is enabled. For information about user proxying, see Section 6.3.11, “Proxy Users”.-
System Variable Name named_pipeVariable Scope Global Dynamic Variable No Platform Specific Windows Permitted Values (Windows) Type boolean Default OFF(Windows only.) Indicates whether the server supports connections over named pipes.
-
Command-Line Format --net-buffer-length=#System Variable Name net_buffer_lengthVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default 16384Min Value 1024Max Value 1048576Each client thread is associated with a connection buffer and result buffer. Both begin with a size given by
net_buffer_lengthbut are dynamically enlarged up tomax_allowed_packetbytes as needed. The result buffer shrinks tonet_buffer_lengthafter each SQL statement.This variable should not normally be changed, but if you have very little memory, you can set it to the expected length of statements sent by clients. If statements exceed this length, the connection buffer is automatically enlarged. The maximum value to which
net_buffer_lengthcan be set is 1MB.The session value of this variable is read only.
-
Command-Line Format --net-read-timeout=#System Variable Name net_read_timeoutVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default 30Min Value 1The number of seconds to wait for more data from a connection before aborting the read. When the server is reading from the client,
net_read_timeoutis the timeout value controlling when to abort. When the server is writing to the client,net_write_timeoutis the timeout value controlling when to abort. See alsoslave_net_timeout. -
Command-Line Format --net-retry-count=#System Variable Name net_retry_countVariable Scope Global, Session Dynamic Variable Yes Permitted Values (32-bit platforms) Type integer Default 10Min Value 1Max Value 4294967295Permitted Values (64-bit platforms) Type integer Default 10Min Value 1Max Value 18446744073709551615If a read or write on a communication port is interrupted, retry this many times before giving up. This value should be set quite high on FreeBSD because internal interrupts are sent to all threads.
-
Command-Line Format --net-write-timeout=#System Variable Name net_write_timeoutVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default 60Min Value 1The number of seconds to wait for a block to be written to a connection before aborting the write. See also
net_read_timeout. -
Command-Line Format --newSystem Variable Name newVariable Scope Global, Session Dynamic Variable Yes Disabled by skip-newPermitted Values Type boolean Default FALSEThis variable was used in MySQL 4.0 to turn on some 4.1 behaviors, and is retained for backward compatibility. Its value is always
OFF. -
Command-Line Format --ngram-token-sizeSystem Variable Name ngram_token_sizeVariable Scope Global Dynamic Variable No Permitted Values Type integer Default 2Min Value 1Max Value 10Defines the n-gram token size for the n-gram full-text parser. The
ngram_token_sizeoption is read-only and can only be modified at startup. The default value is 2 (bigram). The maximum value is 10.For more information about how to configure this variable, see Section 12.9.8, “ngram Full-Text Parser”.
-
Command-Line Format --offline-mode=valSystem Variable Name offline_modeVariable Scope Global Dynamic Variable Yes Permitted Values Type boolean Default OFFWhether the server is in “offline mode”, which has these characteristics:
Connected client users who do not have the
CONNECTION_ADMINorSUPERprivilege are disconnected on the next request, with an appropriate error. Disconnection includes terminating running statements and releasing locks. Such clients also cannot initiate new connections, and receive an appropriate error.Connected client users who have the
CONNECTION_ADMINorSUPERprivilege are not disconnected, and can initiate new connections to manage the server.Replication slave threads are permitted to keep applying data to the server.
Only users who have the
SYSTEM_VARIABLES_ADMINorSUPERprivilege can control offline mode. To put a server in offline mode, change the value of theoffline_modesystem variable fromOFFtoON. To resume normal operations, changeoffline_modefromONtoOFF. In offline mode, clients that are refused access receive anER_SERVER_OFFLINE_MODEerror. -
Command-Line Format --oldSystem Variable Name oldVariable Scope Global Dynamic Variable No oldis a compatibility variable. It is disabled by default, but can be enabled at startup to revert the server to behaviors present in older versions.When
oldis enabled, it changes the default scope of index hints to that used prior to MySQL 5.1.17. That is, index hints with noFORclause apply only to how indexes are used for row retrieval and not to resolution ofORDER BYorGROUP BYclauses. (See Section 8.9.4, “Index Hints”.) Take care about enabling this in a replication setup. With statement-based binary logging, having different modes for the master and slaves might lead to replication errors. -
Command-Line Format --old-alter-tableSystem Variable Name old_alter_tableVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type boolean Default OFFWhen this variable is enabled, the server does not use the optimized method of processing an
ALTER TABLEoperation. It reverts to using a temporary table, copying over the data, and then renaming the temporary table to the original, as used by MySQL 5.0 and earlier. For more information on the operation ofALTER TABLE, see Section 13.1.7, “ALTER TABLE Syntax”.As of MySQL 8.0.2,
ALTER TABLE ... DROP PARTITIONwithold_alter_table=ONrebuilds the partitioned table and attempts to move data from the dropped partition to another partition with a compatiblePARTITION ... VALUESdefinition. Data that cannot be moved to another partition is deleted. In earlier releases,ALTER TABLE ... DROP PARTITIONwithold_alter_table=ONdeletes data stored in the partition and drops the partition. -
Deprecated 5.7.6 System Variable Name old_passwordsVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type enumeration Default 0Valid Values 02NoteThis system variable is deprecated and will be removed in a future MySQL release.
This variable controls the password hashing method used by the
PASSWORD()function. It also influences password hashing performed byCREATE USERandGRANTstatements that specify a password using anIDENTIFIED BYclause.The following table shows the permitted values of
old_passwords, the password hashing method for each value, and which authentication plugins use passwords hashed with each method.Value Password Hashing Method Associated Authentication Plugin 0 MySQL 4.1 native hashing mysql_native_password2 SHA-256 hashing sha256_passwordIf you set
old_passwords=2, follow the instructions for using thesha256_passwordplugin at Section 6.5.1.2, “SHA-256 Pluggable Authentication”.The server sets the global
old_passwordsvalue during startup to be consistent with the password hashing method required by the default authentication plugin. The default plugin ismysql_native_passwordunless thedefault_authentication_pluginsystem variable is set otherwise.When a client successfully connects to the server, the server sets the session
old_passwordsvalue appropriately for the account authentication method. For example, if the account uses thesha256_passwordauthentication plugin, the server setsold_passwords=2.For additional information about authentication plugins, see Section 6.3.10, “Pluggable Authentication”.
-
Command-Line Format --open-files-limit=#System Variable Name open_files_limitVariable Scope Global Dynamic Variable No Permitted Values Type integer Default 5000, with possible adjustmentMin Value 0Max Value platform dependentThe number of files that the operating system permits mysqld to open. The value of this variable at runtime is the real value permitted by the system and might be different from the value you specify at server startup. The value is 0 on systems where MySQL cannot change the number of open files.
The effective
open_files_limitvalue is based on the value specified at system startup (if any) and the values ofmax_connectionsandtable_open_cache, using these formulas:1) 10 + max_connections + (table_open_cache * 2) 2) max_connections * 5 3) open_files_limit value specified at startup, 5000 if noneThe server attempts to obtain the number of file descriptors using the maximum of those three values. If that many descriptors cannot be obtained, the server attempts to obtain as many as the system will permit.
-
Command-Line Format --optimizer-prune-level[=#]System Variable Name optimizer_prune_levelVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type boolean Default 1Controls the heuristics applied during query optimization to prune less-promising partial plans from the optimizer search space. A value of 0 disables heuristics so that the optimizer performs an exhaustive search. A value of 1 causes the optimizer to prune plans based on the number of rows retrieved by intermediate plans.
-
Command-Line Format --optimizer-search-depth[=#]System Variable Name optimizer_search_depthVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default 62Min Value 0Max Value 62The maximum depth of search performed by the query optimizer. Values larger than the number of relations in a query result in better query plans, but take longer to generate an execution plan for a query. Values smaller than the number of relations in a query return an execution plan quicker, but the resulting plan may be far from being optimal. If set to 0, the system automatically picks a reasonable value.
-
Command-Line Format --optimizer-switch=valueSystem Variable Name optimizer_switchVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type set Valid Values batched_key_access={on|off}block_nested_loop={on|off}condition_fanout_filter={on|off}derived_merge={on|off}duplicateweedout={on|off}engine_condition_pushdown={on|off}firstmatch={on|off}index_condition_pushdown={on|off}index_merge={on|off}index_merge_intersection={on|off}index_merge_sort_union={on|off}index_merge_union={on|off}loosescan={on|off}materialization={on|off}mrr={on|off}mrr_cost_based={on|off}semijoin={on|off}subquery_materialization_cost_based={on|off}use_index_extensions={on|off}The
optimizer_switchsystem variable enables control over optimizer behavior. The value of this variable is a set of flags, each of which has a value ofonoroffto indicate whether the corresponding optimizer behavior is enabled or disabled. This variable has global and session values and can be changed at runtime. The global default can be set at server startup.To see the current set of optimizer flags, select the variable value:
mysql> SELECT @@optimizer_switch\G *************************** 1. row *************************** @@optimizer_switch: index_merge=on,index_merge_union=on, index_merge_sort_union=on, index_merge_intersection=on, engine_condition_pushdown=on, index_condition_pushdown=on, mrr=on,mrr_cost_based=on, block_nested_loop=on,batched_key_access=off, materialization=on,semijoin=on,loosescan=on, firstmatch=on,duplicateweedout=on, subquery_materialization_cost_based=on, use_index_extensions=on, condition_fanout_filter=on,derived_merge=onFor more information about the syntax of this variable and the optimizer behaviors that it controls, see Section 8.9.3, “Switchable Optimizations”.
-
System Variable Name optimizer_traceVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type string This variable controls optimizer tracing. For details, see MySQL Internals: Tracing the Optimizer.
-
System Variable Name optimizer_trace_featuresVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type string This variable enables or disables selected optimizer tracing features. For details, see MySQL Internals: Tracing the Optimizer.
-
System Variable Name optimizer_trace_limitVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default 1The maximum number of optimizer traces to display. For details, see MySQL Internals: Tracing the Optimizer.
-
System Variable Name optimizer_trace_max_mem_sizeVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default 16384The maximum cumulative size of stored optimizer traces. For details, see MySQL Internals: Tracing the Optimizer.
-
System Variable Name optimizer_trace_offsetVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default -1The offset of optimizer traces to display. For details, see MySQL Internals: Tracing the Optimizer.
performance_schema_xxxPerformance Schema system variables are listed in Section 25.14, “Performance Schema System Variables”. These variables may be used to configure Performance Schema operation.
-
Command-Line Format --parser-max-mem-size=NSystem Variable Name parser_max_mem_sizeVariable Scope Global, Session Dynamic Variable Yes Permitted Values (32-bit platforms) Type integer Default 4294967295Min Value 10000000Max Value 4294967295Permitted Values (64-bit platforms) Type integer Default 18446744073709551615Min Value 10000000Max Value 18446744073709551615The maximum amount of memory available to the parser. The default value places no limit on memory available. The value can be reduced to protect against out-of-memory situations caused by parsing long or complex SQL statements.
-
Command-Line Format --persisted-globals-load[=ON|OFF]System Variable Name persisted_globals_loadVariable Scope Global Dynamic Variable No Permitted Values Type boolean Default ONWhether to load persisted configuration settings from the
mysqld-auto.cnffile in the data directory. The server normally processes this file at startup after all other option files (see Section 4.2.6, “Using Option Files”). Disablingpersisted_globals_loadcauses the server startup sequence to skipmysqld-auto.cnf.To modify the contents of
mysqld-auto.cnf, use theSET PERSISTorPERSIST_ONLYstatement, or theRESET PERSISTstatement. See Section 13.7.4.1, “SET Syntax for Variable Assignment”. -
Command-Line Format --pid-file=file_nameSystem Variable Name pid_fileVariable Scope Global Dynamic Variable No Permitted Values Type file name The path name of the process ID (PID) file. On Windows, this variable also affects the default error log file name. See Section 5.4.2, “The Error Log” This variable can be set with the
--pid-fileoption. -
Command-Line Format --plugin-dir=dir_nameSystem Variable Name plugin_dirVariable Scope Global Dynamic Variable No Permitted Values Type directory name Default BASEDIR/lib/pluginThe path name of the plugin directory.
If the plugin directory is writable by the server, it may be possible for a user to write executable code to a file in the directory using
SELECT ... INTO DUMPFILE. This can be prevented by makingplugin_dirread only to the server or by setting--secure-file-privto a directory whereSELECTwrites can be made safely. -
Command-Line Format --port=#System Variable Name portVariable Scope Global Dynamic Variable No Permitted Values Type integer Default 3306Min Value 0Max Value 65535The number of the port on which the server listens for TCP/IP connections. This variable can be set with the
--portoption. -
Command-Line Format --preload-buffer-size=#System Variable Name preload_buffer_sizeVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default 32768Min Value 1024Max Value 1073741824The size of the buffer that is allocated when preloading indexes.
If set to 0 or
OFF(the default), statement profiling is disabled. If set to 1 orON, statement profiling is enabled and theSHOW PROFILEandSHOW PROFILESstatements provide access to profiling information. See Section 13.7.5.31, “SHOW PROFILES Syntax”.This variable is deprecated and will be removed in a future MySQL release.
The number of statements for which to maintain profiling information if
profilingis enabled. The default value is 15. The maximum value is 100. Setting the value to 0 effectively disables profiling. See Section 13.7.5.31, “SHOW PROFILES Syntax”.This variable is deprecated and will be removed in a future MySQL release.
-
System Variable Name protocol_versionVariable Scope Global Dynamic Variable No Permitted Values Type integer The version of the client/server protocol used by the MySQL server.
-
System Variable Name proxy_userVariable Scope Session Dynamic Variable No Permitted Values Type string If the current client is a proxy for another user, this variable is the proxy user account name. Otherwise, this variable is
NULL. See Section 6.3.11, “Proxy Users”. -
System Variable Name pseudo_slave_modeVariable Scope Session Dynamic Variable Yes Permitted Values Type integer This variable is for internal server use.
-
System Variable Name pseudo_thread_idVariable Scope Session Dynamic Variable Yes Permitted Values Type integer This variable is for internal server use.
-
Command-Line Format --query-alloc-block-size=#System Variable Name query_alloc_block_sizeVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default 8192Min Value 1024Max Value 4294967295Block Size 1024The allocation size of memory blocks that are allocated for objects created during statement parsing and execution. If you have problems with memory fragmentation, it might help to increase this parameter.
-
Command-Line Format --query-cache-limit=#System Variable Name query_cache_limitVariable Scope Global Dynamic Variable Yes Permitted Values (32-bit platforms) Type integer Default 1048576Min Value 0Max Value 4294967295Permitted Values (64-bit platforms) Type integer Default 1048576Min Value 0Max Value 18446744073709551615Do not cache results that are larger than this number of bytes. The default value is 1MB.
-
Command-Line Format --query-cache-min-res-unit=#System Variable Name query_cache_min_res_unitVariable Scope Global Dynamic Variable Yes Permitted Values (32-bit platforms) Type integer Default 4096Min Value 512Max Value 4294967295Permitted Values (64-bit platforms) Type integer Default 4096Min Value 512Max Value 18446744073709551615The minimum size (in bytes) for blocks allocated by the query cache. The default value is 4096 (4KB). Tuning information for this variable is given in Section 8.10.3.3, “Query Cache Configuration”.
-
Command-Line Format --query-cache-size=#System Variable Name query_cache_sizeVariable Scope Global Dynamic Variable Yes Permitted Values (32-bit platforms, 8.0.0) Type integer Default 1048576Min Value 0Max Value 4294967295Permitted Values (32-bit platforms, >= 8.0.1) Type integer Default 0Min Value 0Max Value 4294967295Permitted Values (64-bit platforms, 8.0.0) Type integer Default 1048576Min Value 0Max Value 18446744073709551615Permitted Values (64-bit platforms, >= 8.0.1) Type integer Default 0Min Value 0Max Value 18446744073709551615The amount of memory allocated for caching query results. By default, the query cache is disabled, achieved using defaults of
query_cache_size=0andquery_cache_type=0.The permissible values are multiples of 1024; other values are rounded down to the nearest multiple. For nonzero values of
query_cache_size, that many bytes of memory are allocated even ifquery_cache_type=0. See Section 8.10.3.3, “Query Cache Configuration”, for more information.The query cache needs a minimum size of about 40KB to allocate its structures. (The exact size depends on system architecture.) If you set the value of
query_cache_sizetoo small, a warning will occur, as described in Section 8.10.3.3, “Query Cache Configuration”. -
Command-Line Format --query-cache-type=#System Variable Name query_cache_typeVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type enumeration Default 0Valid Values 012Set the query cache type. Setting the
GLOBALvalue sets the type for all clients that connect thereafter. Individual clients can set theSESSIONvalue to affect their own use of the query cache. Possible values are shown in the following table.Option Description 0orOFFDo not cache results in or retrieve results from the query cache. Note that this does not deallocate the query cache buffer. To do that, you should set query_cache_sizeto 0.1orONCache all cacheable query results except for those that begin with SELECT SQL_NO_CACHE.2orDEMANDCache results only for cacheable queries that begin with SELECT SQL_CACHE.This variable defaults to
OFF.If the server is started with
query_cache_typeset to 0, it does not acquire the query cache mutex at all, which means that the query cache cannot be enabled at runtime and there is reduced overhead in query execution. -
Command-Line Format --query-cache-wlock-invalidateSystem Variable Name query_cache_wlock_invalidateVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type boolean Default FALSENormally, when one client acquires a
WRITElock on aMyISAMtable, other clients are not blocked from issuing statements that read from the table if the query results are present in the query cache. Setting this variable to 1 causes acquisition of aWRITElock for a table to invalidate any queries in the query cache that refer to the table. This forces other clients that attempt to access the table to wait while the lock is in effect. -
Command-Line Format --query-prealloc-size=#System Variable Name query_prealloc_sizeVariable Scope Global, Session Dynamic Variable Yes Permitted Values (32-bit platforms) Type integer Default 8192Min Value 8192Max Value 4294967295Block Size 1024Permitted Values (64-bit platforms) Type integer Default 8192Min Value 8192Max Value 18446744073709551615Block Size 1024The size of the persistent buffer used for statement parsing and execution. This buffer is not freed between statements. If you are running complex queries, a larger
query_prealloc_sizevalue might be helpful in improving performance, because it can reduce the need for the server to perform memory allocation during query execution operations. The
rand_seed1andrand_seed2variables exist as session variables only, and can be set but not read. The variables—but not their values—are shown in the output ofSHOW VARIABLES.The purpose of these variables is to support replication of the
RAND()function. For statements that invokeRAND(), the master passes two values to the slave, where they are used to seed the random number generator. The slave uses these values to set the session variablesrand_seed1andrand_seed2so thatRAND()on the slave generates the same value as on the master.See the description for
rand_seed1.-
Command-Line Format --range-alloc-block-size=#System Variable Name range_alloc_block_sizeVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default 4096Min Value 4096Max Value 4294967295Block Size 1024Permitted Values (64-bit platforms) Type integer Default 4096Min Value 4096Max Value 18446744073709547520Block Size 1024The size of blocks that are allocated when doing range optimization.
-
Command-Line Format --range-optimizer-max-mem-size=NSystem Variable Name range_optimizer_max_mem_sizeVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default 8388608Min Value 0Max Value 18446744073709551615The limit on memory consumption for the range optimizer. A value of 0 means “no limit.” If an execution plan considered by the optimizer uses the range access method but the optimizer estimates that the amount of memory needed for this method would exceed the limit, it abandons the plan and considers other plans. For more information, see Limiting Memory Use for Range Optimization.
-
System Variable Name rbr_exec_modeVariable Scope Session Dynamic Variable Yes Permitted Values Type enumeration Default STRICTValid Values IDEMPOTENTSTRICTThis variable switches the server between
IDEMPOTENTmode andSTRICTmode.IDEMPOTENTmode causes suppression of duplicate-key and no-key-found errors. This mode is useful when replaying a row-based binary log on a server that causes conflicts with existing data. mysqlbinlog uses this mode when you set the--idempotentoption by writing the following to the output:SET SESSION RBR_EXEC_MODE=IDEMPOTENT; -
Command-Line Format --read-buffer-size=#System Variable Name read_buffer_sizeVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default 131072Min Value 8200Max Value 2147479552Each thread that does a sequential scan for a
MyISAMtable allocates a buffer of this size (in bytes) for each table it scans. If you do many sequential scans, you might want to increase this value, which defaults to 131072. The value of this variable should be a multiple of 4KB. If it is set to a value that is not a multiple of 4KB, its value will be rounded down to the nearest multiple of 4KB.This option is also used in the following context for all storage engines:
For caching the indexes in a temporary file (not a temporary table), when sorting rows for
ORDER BY.For bulk insert into partitions.
For caching results of nested queries.
and in one other storage engine-specific way: to determine the memory block size for
MEMORYtables.The maximum permissible setting for
read_buffer_sizeis 2GB.For more information about memory use during different operations, see Section 8.12.3.1, “How MySQL Uses Memory”.
-
Command-Line Format --read-onlySystem Variable Name read_onlyVariable Scope Global Dynamic Variable Yes Permitted Values Type boolean Default OFFWhen the
read_onlysystem variable is enabled, the server permits no client updates except from users who have theCONNECTION_ADMINorSUPERprivilege. This variable is disabled by default.The server also supports a
super_read_onlysystem variable (disabled by default), which has these effects:If
super_read_onlyis enabled, the server prohibits client updates, even from users who have theSUPERprivilege.Setting
super_read_onlytoONimplicitly forcesread_onlytoON.Setting
read_onlytoOFFimplicitly forcessuper_read_onlytoOFF.
Even with
read_onlyenabled, the server permits these operations:Updates performed by slave threads, if the server is a replication slave. In replication setups, it can be useful to enable
read_onlyon slave servers to ensure that slaves accept updates only from the master server and not from clients.Use of
ANALYZE TABLEorOPTIMIZE TABLEstatements. The purpose of read-only mode is to prevent changes to table structure or contents. Analysis and optimization do not qualify as such changes. This means, for example, that consistency checks on read-only replication slaves can be performed with mysqlcheck --all-databases --analyze.Operations on
TEMPORARYtables.Inserts into the log tables (
mysql.general_logandmysql.slow_log); see Section 5.4.1, “Selecting General Query and Slow Query Log Output Destinations”.Updates to Performance Schema tables, such as
UPDATEorTRUNCATE TABLEoperations.
Changes to
read_onlyon a master server are not replicated to slave servers. The value can be set on a slave server independent of the setting on the master.The following conditions apply to attempts to enable
read_only(including implicit attempts resulting from enablingsuper_read_only):The attempt fails and an error occurs if you have any explicit locks (acquired with
LOCK TABLES) or have a pending transaction.The attempt blocks while other clients hold explicit table locks or have pending transactions, until the locks are released and the transactions end. While the attempt to enable
read_onlyis pending, requests by other clients for table locks or to begin transactions also block untilread_onlyhas been set.The attempt blocks if there are active transactions that hold metadata locks, until those transactions end.
read_onlycan be enabled while you hold a global read lock (acquired withFLUSH TABLES WITH READ LOCK) because that does not involve table locks.
-
Command-Line Format --read-rnd-buffer-size=#System Variable Name read_rnd_buffer_sizeVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default 262144Min Value 1Max Value 2147483647This variable is used for reads from
MyISAMtables, and, for any storage engine, for Multi-Range Read optimization.When reading rows from a
MyISAMtable in sorted order following a key-sorting operation, the rows are read through this buffer to avoid disk seeks. See Section 8.2.1.13, “ORDER BY Optimization”. Setting the variable to a large value can improveORDER BYperformance by a lot. However, this is a buffer allocated for each client, so you should not set the global variable to a large value. Instead, change the session variable only from within those clients that need to run large queries.The maximum permissible setting for
read_rnd_buffer_sizeis 2GB.For more information about memory use during different operations, see Section 8.12.3.1, “How MySQL Uses Memory”. For information about Multi-Range Read optimization, see Section 8.2.1.10, “Multi-Range Read Optimization”.
-
Command-Line Format --relay-log-purgeSystem Variable Name relay_log_purgeVariable Scope Global Dynamic Variable Yes Permitted Values Type boolean Default TRUEDisables or enables automatic purging of relay log files as soon as they are not needed any more. The default value is 1 (
ON). -
Command-Line Format --relay-log-space-limit=#System Variable Name relay_log_space_limitVariable Scope Global Dynamic Variable No Permitted Values (32-bit platforms) Type integer Default 0Min Value 0Max Value 4294967295Permitted Values (64-bit platforms) Type integer Default 0Min Value 0Max Value 18446744073709551615The maximum amount of space to use for all relay logs.
-
Command-Line Format --report-host=host_nameSystem Variable Name report_hostVariable Scope Global Dynamic Variable No Permitted Values Type string The value of the
--report-hostoption. -
Command-Line Format --report-password=nameSystem Variable Name report_passwordVariable Scope Global Dynamic Variable No Permitted Values Type string The value of the
--report-passwordoption. Not the same as the password used for the MySQL replication user account. -
Command-Line Format --report-port=#System Variable Name report_portVariable Scope Global Dynamic Variable No Permitted Values Type integer Default [slave_port]Min Value 0Max Value 65535The value of the
--report-portoption. -
Command-Line Format --report-user=nameSystem Variable Name report_userVariable Scope Global Dynamic Variable No Permitted Values Type string The value of the
--report-useroption. Not the same as the name for the MySQL replication user account. -
Command-Line Format --require-secure-transport[={OFF|ON}]System Variable Name require_secure_transportVariable Scope Global Dynamic Variable Yes Permitted Values Type boolean Default OFFWhether client connections to the server are required to use some form of secure transport. When this variable is enabled, the server permits only TCP/IP connections that use SSL, or connections that use a socket file (on Unix) or shared memory (on Windows). The server rejects nonsecure connection attempts, which fail with an
ER_SECURE_TRANSPORT_REQUIREDerror.This capability supplements per-account SSL requirements, which take precedence. For example, if an account is defined with
REQUIRE SSL, enablingrequire_secure_transportdoes not make it possible to use the account to connect using a Unix socket file.It is possible for a server to have no secure transports available. For example, a server on Windows supports no secure transports if started without specifying any SSL certificate or key files and with the
shared_memorysystem variable disabled. Under these conditions, attempts to enablerequire_secure_transportat startup cause the server to write a message to the error log and exit. Attempts to enable the variable at runtime fail with anER_NO_SECURE_TRANSPORTS_CONFIGUREDerror. -
System Variable Name rpl_semi_sync_master_enabledVariable Scope Global Dynamic Variable Yes Permitted Values Type boolean Default OFFControls whether semisynchronous replication is enabled on the master. To enable or disable the plugin, set this variable to
ONorOFF(or 1 or 0), respectively. The default isOFF.This variable is available only if the master-side semisynchronous replication plugin is installed.
-
System Variable Name rpl_semi_sync_master_timeoutVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default 10000A 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).
This variable is available only if the master-side semisynchronous replication plugin is installed.
rpl_semi_sync_master_trace_levelSystem Variable Name rpl_semi_sync_master_trace_levelVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default 32The semisynchronous replication debug trace level on the master. Four levels are defined:
1 = general level (for example, time function failures)
16 = detail level (more verbose information)
32 = net wait level (more information about network waits)
64 = function level (information about function entry and exit)
This variable is available only if the master-side semisynchronous replication plugin is installed.
rpl_semi_sync_master_wait_for_slave_countSystem Variable Name rpl_semi_sync_master_wait_for_slave_countVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default 1Min Value 1Max Value 65535The number of slave acknowledgments the master must receive per transaction before proceeding. By default
rpl_semi_sync_master_wait_for_slave_countis1, meaning that semisynchronous replication proceeds after receiving a single slave acknowledgment. Performance is best for small values of this variable.For example, if
rpl_semi_sync_master_wait_for_slave_countis2, then 2 slaves must acknowledge receipt of the transaction before the timeout period configured byrpl_semi_sync_master_timeoutfor semisynchronous replication to proceed. If less slaves acknowledge receipt of the transaction during the timeout period, the master reverts to normal replication.NoteThis behavior also depends on
rpl_semi_sync_master_wait_no_slaveThis variable is available only if the master-side semisynchronous replication plugin is installed.
rpl_semi_sync_master_wait_no_slaveSystem Variable Name rpl_semi_sync_master_wait_no_slaveVariable Scope Global Dynamic Variable Yes Permitted Values Type boolean Default ONControls whether the master waits for the timeout period configured by
rpl_semi_sync_master_timeoutto expire, even if the slave count drops to less than the number of slaves configured byrpl_semi_sync_master_wait_for_slave_countduring the timeout period.When the value of
rpl_semi_sync_master_wait_no_slaveisON(the default), it is permissible for the slave count to drop to less thanrpl_semi_sync_master_wait_for_slave_countduring the timeout period. As long as enough slaves acknowledge the transaction before the timeout period expires, semisynchronous replication continues.When the value of
rpl_semi_sync_master_wait_no_slaveisOFF, if the slave count drops to less than the number configured inrpl_semi_sync_master_wait_for_slave_countat any time during the timeout period configured byrpl_semi_sync_master_timeout, the master reverts to normal replication.This variable is available only if the master-side semisynchronous replication plugin is installed.
rpl_semi_sync_master_wait_pointSystem Variable Name rpl_semi_sync_master_wait_pointVariable Scope Global Dynamic Variable Yes Permitted Values Type enumeration Default AFTER_SYNCValid Values AFTER_SYNCAFTER_COMMITThis variable controls the point at which a semisynchronous replication master waits for slave acknowledgment of transaction receipt before returning a status to the client that committed the transaction. These values are permitted:
AFTER_SYNC(the default): The master writes each transaction to its binary log and the slave, and syncs the binary log to disk. The master waits for slave acknowledgment of transaction receipt after the sync. Upon receiving acknowledgment, the master commits the transaction to the storage engine and returns a result to the client, which then can proceed.AFTER_COMMIT: The master writes each transaction to its binary log and the slave, syncs the binary log, and commits the transaction to the storage engine. The master waits for slave acknowledgment of transaction receipt after the commit. Upon receiving acknowledgment, the master returns a result to the client, which then can proceed.
The replication characteristics of these settings differ as follows:
With
AFTER_SYNC, all clients see the committed transaction at the same time: After it has been acknowledged by the slave and committed to the storage engine on the master. Thus, all clients see the same data on the master.In the event of master failure, all transactions committed on the master have been replicated to the slave (saved to its relay log). A crash of the master and failover to the slave is lossless because the slave is up to date.
With
AFTER_COMMIT, the client issuing the transaction gets a return status only after the server commits to the storage engine and receives slave acknowledgment. After the commit and before slave acknowledgment, other clients can see the committed transaction before the committing client.If something goes wrong such that the slave does not process the transaction, then in the event of a master crash and failover to the slave, it is possible that such clients will see a loss of data relative to what they saw on the master.
This variable is available only if the master-side semisynchronous replication plugin is installed.
With the addition of
rpl_semi_sync_master_wait_pointin MySQL 5.7, a version compatibility constraint was created because it increments the semisynchronous interface version: Servers for MySQL 5.7 and higher do not work with semisynchronous replication plugins from older versions, nor do servers from older versions work with semisynchronous replication plugins for MySQL 5.7 and higher.-
System Variable Name rpl_semi_sync_slave_enabledVariable Scope Global Dynamic Variable Yes Permitted Values Type boolean Default OFFControls whether semisynchronous replication is enabled on the slave. To enable or disable the plugin, set this variable to
ONorOFF(or 1 or 0), respectively. The default isOFF.This variable is available only if the slave-side semisynchronous replication plugin is installed.
rpl_semi_sync_slave_trace_levelSystem Variable Name rpl_semi_sync_slave_trace_levelVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default 32The semisynchronous replication debug trace level on the slave. See
rpl_semi_sync_master_trace_levelfor the permissible values.This variable is available only if the slave-side semisynchronous replication plugin is installed.
-
Command-Line Format --schema-definition-cache=NSystem Variable Name schema_definition_cacheVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default 256Min Value 256Max Value 524288Defines a limit for the number of schema definition objects, both used and unused, that can be kept in the dictionary object cache.
Unused schema definition objects are only kept in the dictionary object cache when the number in use is less than the capacity defined by
schema_definition_cache.A setting of
0means that schema definition objects are only kept in the dictionary object cache while they are in use.For more information, see Section 14.4, “Dictionary Object Cache”.
-
Deprecated 5.7.5 Command-Line Format --secure-authSystem Variable Name secure_authVariable Scope Global Dynamic Variable Yes Permitted Values Type boolean Default ONValid Values ONIf 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.
Enable this variable to prevent all use of passwords employing the old format (and hence insecure communication over the network).
This variable is deprecated and will be removed in a future MySQL release. It is always enabled and attempting to disable it produces an error.
Server startup fails with an error if this variable is enabled and the privilege tables are in pre-4.1 format.
NotePasswords that use the pre-4.1 hashing method are less secure than passwords that use the native password hashing method and should be avoided. Pre-4.1 passwords are deprecated and support for them has been removed.
-
Command-Line Format --secure-file-priv=dir_nameSystem Variable Name secure_file_privVariable Scope Global Dynamic Variable No Permitted Values Type string Default platform specificValid Values emptydirnameNULLThis variable is used to limit the effect of data import and export operations, such as those performed by the
LOAD DATAandSELECT ... INTO OUTFILEstatements and theLOAD_FILE()function. These operations are permitted only to users who have theFILEprivilege.secure_file_privmay be set as follows:If empty, the variable has no effect. This is not a secure setting.
If set to the name of a directory, the server limits import and export operations to work only with files in that directory. The directory must exist; the server will not create it.
If set to
NULL, the server disables import and export operations.
The default value is platform specific and depends on the value of the
INSTALL_LAYOUTCMake option, as shown in the following table. To specify the defaultsecure_file_privvalue explicitly if you are building from source, use theINSTALL_SECURE_FILE_PRIVDIRCMake option.INSTALL_LAYOUTValueDefault secure_file_privValueSTANDALONE,WINempty DEB,RPM,SLES,SVR4/var/lib/mysql-filesOtherwise mysql-filesunder theCMAKE_INSTALL_PREFIXvalueThe server checks the value of
secure_file_privat startup and writes a warning to the error log if the value is insecure. A non-NULLvalue is considered insecure if it is empty, or the value is the data directory or a subdirectory of it, or a directory that is accessible by all users. Ifsecure_file_privis set to a nonexistent path, the server writes an error message to the error log and exits. -
Command-Line Format --server-id=#System Variable Name server_idVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default 0Min Value 0Max Value 4294967295The server ID, used in replication to give each master and slave a unique identity. This variable is set by the
--server-idoption. For each server participating in replication, you should pick a positive integer in the range from 1 to 232 − 1 to act as that server's ID. -
Command-Line Format --session-track-gtids=[value]System Variable Name session_track_gtidsVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type enumeration Default OFFValid Values OFFOWN_GTIDALL_GTIDSControls a tracker for capturing GTIDs and returning them in the OK packet. Depending on the value of this option, at the end of executing a transaction, the GTIDs specified are captured by the tracker and appended to the OK packet. The possible sets of GTIDs to track are:
OFFmeans that no GTIDs are included in the OK packet. This is the same behavior as versions of MySQL prior to 5.7.6.OWN_GTIDconfigures the tracker to collect GTIDs generated by successfully committed read/write transactions.ALL_GTIDSconfigures the tracker to collect all of the GTIDs ingtid_executedat the time the current transaction commits, regardless of whether the transaction is read/write or read-only.
For information about obtaining session state-change information within client programs, see Section 27.7.7.67, “mysql_session_track_get_first()”.
-
Command-Line Format --session-track-schema=#System Variable Name session_track_schemaVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type boolean Default ONControls whether the server tracks changes to the default schema (database) name within the current session and makes this information available to the client when changes occur.
If notification is enabled, any setting of the default schema is reported, even if the new schema name is the same as the old.
For information about obtaining session state-change information within client programs, see Section 27.7.7.67, “mysql_session_track_get_first()”.
-
Command-Line Format --session-track-state-change=#System Variable Name session_track_state_changeVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type boolean Default OFFControls whether the server tracks changes to the state of the current session and notifies the client when state changes occur. Session state consists of these values:
The default schema (database)
Session-specific values for system variables
User-defined variables
Temporary tables
Prepared statements
If the session-state tracker is enabled, any assignments to session state values are reported, even if the new values are the same as the old.
The
session_track_state_changevariable controls only notification of when changes occur, not what the changes are. To receive notification for changes to the default schema name and session system variable values, use thesession_track_schemaandsession_track_system_variablessystem variables.For information about obtaining session state-change information within client programs, see Section 27.7.7.67, “mysql_session_track_get_first()”.
session_track_system_variablesCommand-Line Format --session-track-system-variables=#System Variable Name session_track_system_variablesVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type string Default time_zone, autocommit, character_set_client, character_set_results, character_set_connectionControls whether the server tracks changes to the session system variables and makes this information available to the client when changes occur. The variable value is a comma-separated list of variables for which to track changes. By default, notification is enabled for
time_zone,autocommit,character_set_client,character_set_results, andcharacter_set_connection. (The latter three variables are those affected bySET NAMES.)The special value
*causes the server to track changes to all session variables. If given, this value must be specified by itself without specific system variable names.Notification occurs for all assignments to tracked session system variables, even if the new values are the same as the old.
For information about obtaining session state-change information within client programs, see Section 27.7.7.67, “mysql_session_track_get_first()”.
sha256_password_auto_generate_rsa_keysCommand-Line Format --sha256-password-auto-generate-rsa-keys[={OFF|ON}]System Variable Name sha256_password_auto_generate_rsa_keysVariable Scope Global Dynamic Variable No Permitted Values Type boolean Default ONThis variable is available if the server was compiled using OpenSSL (see Section 6.4.1, “OpenSSL Versus yaSSL”). It controls whether the server autogenerates RSA private/public key-pair files in the data directory, if they do not already exist.
At startup, the server automatically generates RSA private/public key-pair files in the data directory if the
sha256_password_auto_generate_rsa_keyssystem variable is enabled, no RSA options are specified, and the RSA files are missing from the data directory. These files enable secure password exchange using RSA over unencrypted connections for accounts authenticated by thesha256_passwordplugin; see Section 6.5.1.2, “SHA-256 Pluggable Authentication”.For more information about RSA file autogeneration, including file names and characteristics, see Section 6.4.6.1, “Creating SSL and RSA Certificates and Keys using MySQL”
The
auto_generate_certssystem variable is related but controls autogeneration of SSL certificate and key files needed for secure connections using SSL.sha256_password_private_key_pathSystem Variable Name sha256_password_private_key_pathVariable Scope Global Dynamic Variable No Permitted Values Type file name Default private_key.pemThis variable is available if MySQL was compiled using OpenSSL (see Section 6.4.1, “OpenSSL Versus yaSSL”). Its value is the path name of the RSA private key file for the
sha256_passwordauthentication plugin. If the file is named as a relative path, it is interpreted relative to the server data directory. The file must be in PEM format. Because this file stores a private key, its access mode should be restricted so that only the MySQL server can read it.For information about
sha256_password, including instructions for creating the RSA key files, see Section 6.5.1.2, “SHA-256 Pluggable Authentication”.-
Command-Line Format --sha256-password-proxy-users=[={OFF|ON}]System Variable Name sha256_password_proxy_usersVariable Scope Global Dynamic Variable Yes Permitted Values Type boolean Default OFFThis variable controls whether the
sha256_passwordbuilt-in authentication plugin supports proxy users. It has no effect unless thecheck_proxy_userssystem variable is enabled. For information about user proxying, see Section 6.3.11, “Proxy Users”. sha256_password_public_key_pathSystem Variable Name sha256_password_public_key_pathVariable Scope Global Dynamic Variable No Permitted Values Type file name Default public_key.pemThis variable is available if MySQL was compiled using OpenSSL (see Section 6.4.1, “OpenSSL Versus yaSSL”). Its value is the path name of the RSA public key file for the
sha256_passwordauthentication plugin. If the file is named as a relative path, it is interpreted relative to the server data directory. The file must be in PEM format. Because this file stores a public key, copies can be freely distributed to client users. (Clients that explicitly specify a public key when connecting to the server using RSA password encryption must use the same public key as that used by the server.)For information about
sha256_password, including instructions for creating the RSA key files and how clients specify the RSA public key, see Section 6.5.1.2, “SHA-256 Pluggable Authentication”.-
Command-Line Format --shared-memory[={0,1}]System Variable Name shared_memoryVariable Scope Global Dynamic Variable No Platform Specific Windows Permitted Values Type boolean Default FALSE(Windows only.) Whether the server permits shared-memory connections.
-
Command-Line Format --shared-memory-base-name=nameSystem Variable Name shared_memory_base_nameVariable Scope Global Dynamic Variable No Platform Specific Windows Permitted Values Type string Default MYSQL(Windows only.) The name of shared memory to use for shared-memory connections. This is useful when running multiple MySQL instances on a single physical machine. The default name is
MYSQL. The name is case sensitive. -
Deprecated 5.7.6 Removed 8.0.1 Command-Line Format --show-compatibility-56[={OFF|ON}]System Variable Name show_compatibility_56Variable Scope Global Dynamic Variable Yes Permitted Values Type boolean Default OFFThis variable was used in the transition period during which system and status variable information in
INFORMATION_SCHEMAtables was moved to Performance Schema tables. That transition period ended in MySQL 8.0.1, at which time this variable was removed. For advice on migrating away from theINFORMATION_SCHEMAtables to the Performance Schema tables, see Migrating to Performance Schema System and Status Variable Tables. -
Deprecated 5.7.6 Command-Line Format --show-old-temporals={OFF|ON}System Variable Name show_old_temporalsVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type boolean Default OFFWhether
SHOW CREATE TABLEoutput includes comments to flag temporal columns found to be in pre-5.6.4 format (TIME,DATETIME, andTIMESTAMPcolumns without support for fractional seconds precision). This variable is disabled by default. If enabled,SHOW CREATE TABLEoutput looks like this:CREATE TABLE `mytbl` ( `ts` timestamp /* 5.5 binary format */ NOT NULL DEFAULT CURRENT_TIMESTAMP, `dt` datetime /* 5.5 binary format */ DEFAULT NULL, `t` time /* 5.5 binary format */ DEFAULT NULL ) DEFAULT CHARSET=utf8mb4Output for the
COLUMN_TYPEcolumn of theINFORMATION_SCHEMA.COLUMNStable is affected similarly.This variable is deprecated and will be removed in a future MySQL release.
-
Command-Line Format --skip-external-lockingSystem Variable Name skip_external_lockingVariable Scope Global Dynamic Variable No Permitted Values Type boolean Default ONThis is
OFFif mysqld uses external locking (system locking),ONif external locking is disabled. This affects onlyMyISAMtable access.This variable is set by the
--external-lockingor--skip-external-lockingoption. External locking is disabled by default.External locking affects only
MyISAMtable access. For more information, including conditions under which it can and cannot be used, see Section 8.11.5, “External Locking”. -
Command-Line Format --skip-name-resolveSystem Variable Name skip_name_resolveVariable Scope Global Dynamic Variable No Permitted Values Type boolean Default OFFThis variable is set from the value of the
--skip-name-resolveoption. If it isOFF, mysqld resolves host names when checking client connections. If it isON, mysqld uses only IP numbers; in this case, allHostcolumn values in the grant tables must be IP addresses orlocalhost. See Section 8.12.4.2, “DNS Lookup Optimization and the Host Cache”. -
Command-Line Format --skip-networkingSystem Variable Name skip_networkingVariable Scope Global Dynamic Variable No This is
ONif the server permits only local (non-TCP/IP) connections. On Unix, local connections use a Unix socket file. On Windows, local connections use a named pipe or shared memory. This variable can be set toONwith the--skip-networkingoption. -
Command-Line Format --skip-show-databaseSystem Variable Name skip_show_databaseVariable Scope Global Dynamic Variable No This prevents people from using the
SHOW DATABASESstatement if they do not have theSHOW DATABASESprivilege. This can improve security if you have concerns about users being able to see databases belonging to other users. Its effect depends on theSHOW DATABASESprivilege: If the variable value isON, theSHOW DATABASESstatement is permitted only to users who have theSHOW DATABASESprivilege, and the statement displays all database names. If the value isOFF,SHOW DATABASESis permitted to all users, but displays the names of only those databases for which the user has theSHOW DATABASESor other privilege. (Note that any global privilege is considered a privilege for the database.) -
Command-Line Format --slow-launch-time=#System Variable Name slow_launch_timeVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default 2If creating a thread takes longer than this many seconds, the server increments the
Slow_launch_threadsstatus variable. -
Command-Line Format --slow-query-logSystem Variable Name slow_query_logVariable Scope Global Dynamic Variable Yes Permitted Values Type boolean Default OFFWhether the slow query log is enabled. The value can be 0 (or
OFF) to disable the log or 1 (orON) to enable the log. The default value depends on whether the--slow_query_logoption is given. The destination for log output is controlled by thelog_outputsystem variable; if that value isNONE, no log entries are written even if the log is enabled.“Slow” is determined by the value of the
long_query_timevariable. See Section 5.4.5, “The Slow Query Log”. -
Command-Line Format --slow-query-log-file=file_nameSystem Variable Name slow_query_log_fileVariable Scope Global Dynamic Variable Yes Permitted Values Type file name Default host_name-slow.logThe name of the slow query log file. The default value is
, but the initial value can be changed with thehost_name-slow.log--slow_query_log_fileoption. -
Command-Line Format --socket={file_name|pipe_name}System Variable Name socketVariable Scope Global Dynamic Variable No Permitted Values Type string Default /tmp/mysql.sockOn Unix platforms, this variable is the name of the socket file that is used for local client connections. The default is
/tmp/mysql.sock. (For some distribution formats, the directory might be different, such as/var/lib/mysqlfor RPMs.)On Windows, this variable is the name of the named pipe that is used for local client connections. The default value is
MySQL(not case sensitive). -
Command-Line Format --sort-buffer-size=#System Variable Name sort_buffer_sizeVariable Scope Global, Session Dynamic Variable Yes Permitted Values (Windows) Type integer Default 262144Min Value 32768Max Value 4294967295Permitted Values (Other, 32-bit platforms) Type integer Default 262144Min Value 32768Max Value 4294967295Permitted Values (Other, 64-bit platforms) Type integer Default 262144Min Value 32768Max Value 18446744073709551615Each session that must perform a sort allocates a buffer of this size.
sort_buffer_sizeis not specific to any storage engine and applies in a general manner for optimization. At minimum thesort_buffer_sizevalue must be large enough to accommodate fifteen tuples in the sort buffer. Also, increasing the value ofmax_sort_lengthmay require increasing the value ofsort_buffer_size. For more information, see Section 8.2.1.13, “ORDER BY Optimization”If you see many
Sort_merge_passesper second inSHOW GLOBAL STATUSoutput, you can consider increasing thesort_buffer_sizevalue to speed upORDER BYorGROUP BYoperations that cannot be improved with query optimization or improved indexing.The optimizer tries to work out how much space is needed but can allocate more, up to the limit. Setting it larger than required globally will slow down most queries that sort. It is best to increase it as a session setting, and only for the sessions that need a larger size. On Linux, there are thresholds of 256KB and 2MB where larger values may significantly slow down memory allocation, so you should consider staying below one of those values. Experiment to find the best value for your workload. See Section B.5.3.5, “Where MySQL Stores Temporary Files”.
The maximum permissible setting for
sort_buffer_sizeis 4GB−1. Larger values are permitted for 64-bit platforms (except 64-bit Windows, for which large values are truncated to 4GB−1 with a warning). -
System Variable Name sql_auto_is_nullVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type boolean Default 0If this variable is set to 1, then after a statement that successfully inserts an automatically generated
AUTO_INCREMENTvalue, you can find that value by issuing a statement of the following form:SELECT * FROM tbl_name WHERE auto_col IS NULLIf the statement returns a row, the value returned is the same as if you invoked the
LAST_INSERT_ID()function. For details, including the return value after a multiple-row insert, see Section 12.14, “Information Functions”. If noAUTO_INCREMENTvalue was successfully inserted, theSELECTstatement returns no row.The behavior of retrieving an
AUTO_INCREMENTvalue by using anIS NULLcomparison is used by some ODBC programs, such as Access. See Obtaining Auto-Increment Values. This behavior can be disabled by settingsql_auto_is_nullto 0.The default value of
sql_auto_is_nullis 0. -
System Variable Name sql_big_selectsVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type boolean Default 1If set to 0, MySQL aborts
SELECTstatements 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 ofmax_join_size). This is useful when an inadvisableWHEREstatement has been issued. The default value for a new connection is 1, which permits allSELECTstatements.If you set the
max_join_sizesystem variable to a value other thanDEFAULT,sql_big_selectsis set to 0. -
System Variable Name sql_buffer_resultVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type boolean Default 0If set to 1,
sql_buffer_resultforces results fromSELECTstatements to be put into temporary tables. This helps MySQL free the table locks early and can be beneficial in cases where it takes a long time to send results to the client. The default value is 0. -
System Variable Name sql_log_binVariable Scope Session Dynamic Variable Yes Permitted Values Type boolean 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
SYSTEM_VARIABLES_ADMINorSUPERprivilege to set this variable.Setting this variable to 0 prevents GTIDs from being assigned to transactions in the binary log. If you are using GTIDs for replication, this means that, even when binary logging is later enabled once again, the GTIDs written into the log from this point do not account for any transactions that occurred in the meantime—in effect, those transactions are lost.
In MySQL 8.0, it is not possible to set
@@session.sql_log_binwithin a transaction or subquery. (Bug #53437) -
System Variable Name sql_log_offVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type boolean Default 0This 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
SUPERprivilege to set this option. The default value is 0. -
Command-Line Format --sql-mode=nameSystem Variable Name sql_modeVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type set Default ONLY_FULL_GROUP_BY STRICT_TRANS_TABLES NO_ZERO_IN_DATE NO_ZERO_DATE ERROR_FOR_DIVISION_BY_ZERO NO_AUTO_CREATE_USER NO_ENGINE_SUBSTITUTIONValid Values ALLOW_INVALID_DATESANSI_QUOTESERROR_FOR_DIVISION_BY_ZEROHIGH_NOT_PRECEDENCEIGNORE_SPACENO_AUTO_CREATE_USERNO_AUTO_VALUE_ON_ZERONO_BACKSLASH_ESCAPESNO_DIR_IN_CREATENO_ENGINE_SUBSTITUTIONNO_FIELD_OPTIONSNO_KEY_OPTIONSNO_TABLE_OPTIONSNO_UNSIGNED_SUBTRACTIONNO_ZERO_DATENO_ZERO_IN_DATEONLY_FULL_GROUP_BYPAD_CHAR_TO_FULL_LENGTHPIPES_AS_CONCATREAL_AS_FLOATSTRICT_ALL_TABLESSTRICT_TRANS_TABLESPermitted Values (>= 8.0.1) Type set Default ONLY_FULL_GROUP_BY STRICT_TRANS_TABLES NO_ZERO_IN_DATE NO_ZERO_DATE ERROR_FOR_DIVISION_BY_ZERO NO_AUTO_CREATE_USER NO_ENGINE_SUBSTITUTIONValid Values ALLOW_INVALID_DATESANSI_QUOTESERROR_FOR_DIVISION_BY_ZEROHIGH_NOT_PRECEDENCEIGNORE_SPACENO_AUTO_CREATE_USERNO_AUTO_VALUE_ON_ZERONO_BACKSLASH_ESCAPESNO_DIR_IN_CREATENO_ENGINE_SUBSTITUTIONNO_FIELD_OPTIONSNO_KEY_OPTIONSNO_TABLE_OPTIONSNO_UNSIGNED_SUBTRACTIONNO_ZERO_DATENO_ZERO_IN_DATEONLY_FULL_GROUP_BYPAD_CHAR_TO_FULL_LENGTHPIPES_AS_CONCATREAL_AS_FLOATSTRICT_ALL_TABLESSTRICT_TRANS_TABLESTIME_TRUNCATE_FRACTIONALThe current server SQL mode, which can be set dynamically. For details, see Section 5.1.8, “Server SQL Modes”.
NoteMySQL installation programs may configure the SQL mode during the installation process.
If the SQL mode differs from the default or from what you expect, check for a setting in an option file that the server reads at startup.
If set to 1 (the default), warnings of
Notelevel incrementwarning_countand the server records them. If set to 0,Notewarnings do not incrementwarning_countand the server does not record them. mysqldump includes output to set this variable to 0 so that reloading the dump file does not produce warnings for events that do not affect the integrity of the reload operation.If set to 1 (the default), the server quotes identifiers for
SHOW CREATE TABLEandSHOW CREATE DATABASEstatements. If set to 0, quoting is disabled. This option is enabled by default so that replication works for identifiers that require quoting. See Section 13.7.5.10, “SHOW CREATE TABLE Syntax”, and Section 13.7.5.6, “SHOW CREATE DATABASE Syntax”.If set to 1, MySQL aborts
UPDATEorDELETEstatements that do not use a key in theWHEREclause or aLIMITclause. (Specifically,UPDATEstatements must have aWHEREclause that uses a key or aLIMITclause, or both.DELETEstatements must have both.) This makes it possible to catchUPDATEorDELETEstatements where keys are not used properly and that would probably change or delete a large number of rows. The default value is 0.-
System Variable Name sql_select_limitVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer The maximum number of rows to return from
SELECTstatements. The default value for a new connection is the maximum number of rows that the server permits per table. Typical default values are (232)−1 or (264)−1. If you have changed the limit, the default value can be restored by assigning a value ofDEFAULT.If a
SELECThas aLIMITclause, theLIMITtakes precedence over the value ofsql_select_limit. This variable controls whether single-row
INSERTstatements produce an information string if warnings occur. The default is 0. Set the value to 1 to produce an information string.-
Command-Line Format --ssl-ca=file_nameSystem Variable Name ssl_caVariable Scope Global Dynamic Variable No Permitted Values Type file name The path to a file with a list of trusted SSL CAs.
-
Command-Line Format --ssl-capath=dir_nameSystem Variable Name ssl_capathVariable Scope Global Dynamic Variable No Permitted Values Type directory name The path to a directory that contains trusted SSL CA certificates in PEM format.
-
Command-Line Format --ssl-cert=file_nameSystem Variable Name ssl_certVariable Scope Global Dynamic Variable No Permitted Values Type file name The name of the SSL certificate file to use for establishing a secure connection.
-
Command-Line Format --ssl-cipher=nameSystem Variable Name ssl_cipherVariable Scope Global Dynamic Variable No Permitted Values Type string A list of permissible ciphers to use for SSL encryption.
-
Command-Line Format --ssl-crl=file_nameSystem Variable Name ssl_crlVariable Scope Global Dynamic Variable No Permitted Values Type file name The path to a file containing certificate revocation lists in PEM format. Revocation lists work for MySQL distributions compiled using OpenSSL (but not yaSSL). See Section 6.4.1, “OpenSSL Versus yaSSL”.
-
Command-Line Format --ssl-crlpath=dir_nameSystem Variable Name ssl_crlpathVariable Scope Global Dynamic Variable No Permitted Values Type directory name The path to a directory that contains files containing certificate revocation lists in PEM format. Revocation lists work for MySQL distributions compiled using OpenSSL (but not yaSSL). See Section 6.4.1, “OpenSSL Versus yaSSL”.
-
Command-Line Format --ssl-key=file_nameSystem Variable Name ssl_keyVariable Scope Global Dynamic Variable No Permitted Values Type file name The name of the SSL key file to use for establishing a secure connection.
-
Command-Line Format --stored-program-cache=#System Variable Name stored_program_cacheVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default 256Min Value 16Max Value 524288Sets a soft upper limit for the number of cached stored routines per connection. The value of this variable is specified in terms of the number of stored routines held in each of the two caches maintained by the MySQL Server for, respectively, stored procedures and stored functions.
Whenever a stored routine is executed this cache size is checked before the first or top-level statement in the routine is parsed; if the number of routines of the same type (stored procedures or stored functions according to which is being executed) exceeds the limit specified by this variable, the corresponding cache is flushed and memory previously allocated for cached objects is freed. This allows the cache to be flushed safely, even when there are dependencies between stored routines.
The stored procedure and stored function caches exists in parallel with the stored program definition cache partition of the dictionary object cache. The stored procedure and stored function caches are per connection, while the stored program definition cache is shared. The existence of objects in the stored procedure and stored function caches have no dependence on the existence of objects in the stored program definition cache, and vice versa. For more information, see Section 14.4, “Dictionary Object Cache”.
stored_program_definition_cacheCommand-Line Format --stored-program-definition-cache=NSystem Variable Name stored_program_definition_cacheVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default 256Min Value 256Max Value 524288Defines a limit for the number of stored program definition objects, both used and unused, that can be kept in the dictionary object cache.
Unused stored program definition objects are only kept in the dictionary object cache when the number in use is less than the capacity defined by
stored_program_definition_cache.A setting of 0 means that stored program definition objects are only kept in the dictionary object cache while they are in use.
The stored program definition cache partition exists in parallel with the stored procedure and stored function caches that are configured using the
stored_program_cacheoption.The
stored_program_cacheoption sets a soft upper limit for the number of cached stored procedures or functions per connection, and the limit is checked each time a connection executes a stored procedure or function. The stored program definition cache partition, on the other hand, is a shared cache that stores stored program definition objects for other purposes. The existence of objects in the stored program definition cache partition has no dependence on the existence of objects in the stored procedure cache or stored function cache, and vice versa.For related information, see Section 14.4, “Dictionary Object Cache”.
-
Command-Line Format --super-read-only[={OFF|ON}]System Variable Name super_read_onlyVariable Scope Global Dynamic Variable Yes Permitted Values Type boolean Default OFFIf the
read_onlysystem variable is enabled, the server permits client updates only from users who have theSUPERprivilege. If thesuper_read_onlysystem variable is also enabled, the server prohibits client updates even from users who haveSUPER. See the description of theread_onlysystem variable for a description of read-only mode and information about howread_onlyandsuper_read_onlyinteract.Changes to
super_read_onlyon a master server are not replicated to slave servers. The value can be set on a slave server independent of the setting on the master. -
System Variable Name system_time_zoneVariable Scope Global Dynamic Variable No Permitted Values Type string The server system time zone. When the server begins executing, it inherits a time zone setting from the machine defaults, possibly modified by the environment of the account used for running the server or the startup script. The value is used to set
system_time_zone. Typically the time zone is specified by theTZenvironment variable. It also can be specified using the--timezoneoption of the mysqld_safe script.The
system_time_zonevariable differs fromtime_zone. Although they might have the same value, the latter variable is used to initialize the time zone for each client that connects. See Section 10.6, “MySQL Server Time Zone Support”. -
Command-Line Format --tablespace-definition-cache=NSystem Variable Name tablespace_definition_cacheVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default 256Min Value 256Max Value 524288Defines a limit for the number of tablespace definition objects, both used and unused, that can be kept in the dictionary object cache.
Unused tablespace definition objects are only kept in the dictionary object cache when the number in use is less than the capacity defined by
tablespace_definition_cache.A setting of
0means that tablespace definition objects are only kept in the dictionary object cache while they are in use.For more information, see Section 14.4, “Dictionary Object Cache”.
-
System Variable Name table_definition_cacheVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default -1 (autosized)Min Value 400Max Value 524288The number of table definitions that can be stored in the definition cache. If you use a large number of tables, you can create a large table definition cache to speed up opening of tables. The table definition cache takes less space and does not use file descriptors, unlike the normal table cache. The minimum value is 400. The default value is based on the following formula, capped to a limit of 2000:
400 + (table_open_cache / 2)For
InnoDB,table_definition_cacheacts as a soft limit for the number of open table instances in theInnoDBdata dictionary cache. If the number of open table instances exceeds thetable_definition_cachesetting, the LRU mechanism begins to mark table instances for eviction and eventually removes them from the data dictionary cache. The limit helps address situations in which significant amounts of memory would be used to cache rarely used table instances until the next server restart. The number of table instances with cached metadata could be higher than the limit defined bytable_definition_cache, becauseInnoDBsystem table instances and parent and child table instances with foreign key relationships are not placed on the LRU list and are not subject to eviction from memory.Additionally,
table_definition_cachedefines a soft limit for the number ofInnoDBfile-per-table tablespaces that can be open at one time, which is also controlled byinnodb_open_files. If bothtable_definition_cacheandinnodb_open_filesare set, the highest setting is used. If neither variable is set,table_definition_cache, which has a higher default value, is used. If the number of open tablespace file handles exceeds the limit defined bytable_definition_cacheorinnodb_open_files, the LRU mechanism searches the tablespace file LRU list for files that are fully flushed and are not currently being extended. This process is performed each time a new tablespace is opened. If there are no “inactive” tablespaces, no tablespace files are closed.The table definition cache exists in parallel with the table definition cache partition of the dictionary object cache. Both caches store table definitions but serve different parts of the MySQL server. Objects in one cache have no dependence on the existence objects in the other. For more information, see Section 14.4, “Dictionary Object Cache”.
-
System Variable Name table_open_cacheVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default 2000Min Value 1Max Value 524288The number of open tables for all threads. Increasing this value increases the number of file descriptors that mysqld requires. You can check whether you need to increase the table cache by checking the
Opened_tablesstatus variable. See Section 5.1.7, “Server Status Variables”. If the value ofOpened_tablesis large and you do not useFLUSH TABLESoften (which just forces all tables to be closed and reopened), then you should increase the value of thetable_open_cachevariable. For more information about the table cache, see Section 8.4.3.1, “How MySQL Opens and Closes Tables”. -
System Variable Name table_open_cache_instancesVariable Scope Global Dynamic Variable No Permitted Values Type integer Default 16Min Value 1Max Value 64The number of open tables cache instances. To improve scalability by reducing contention among sessions, the open tables cache can be partitioned into several smaller cache instances of size
table_open_cache/table_open_cache_instances. A session needs to lock only one instance to access it for DML statements. This segments cache access among instances, permitting higher performance for operations that use the cache when there are many sessions accessing tables. (DDL statements still require a lock on the entire cache, but such statements are much less frequent than DML statements.)A value of 8 or 16 is recommended on systems that routinely use 16 or more cores.
-
Introduced 8.0.2 Command-Line Format --temptable-max-ram=#System Variable Name temptable_max_ramVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default 1073741824Min Value 2097152Max Value 2^64-1Defines the maximum amount of memory that the TempTable storage engine can use before data is stored to disk. The default value is 1073741824 bits (1GiB). For more information, see Section 8.4.4, “Internal Temporary Table Use in MySQL”.
-
Command-Line Format --thread-cache-size=#System Variable Name thread_cache_sizeVariable Scope Global Dynamic Variable Yes Permitted Values Type integer Default -1 (autosized)Min Value 0Max Value 16384How 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_sizethreads 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 setthread_cache_sizehigh enough so that most new connections use cached threads. By examining the difference between theConnectionsandThreads_createdstatus variables, you can see how efficient the thread cache is. For details, see Section 5.1.7, “Server Status Variables”.The default value is based on the following formula, capped to a limit of 100:
8 + (max_connections / 100) -
Command-Line Format --thread-handling=nameSystem Variable Name thread_handlingVariable Scope Global Dynamic Variable No Permitted Values Type enumeration Default one-thread-per-connectionValid Values no-threadsone-thread-per-connectiondynamically-loadedThe thread-handling model used by the server for connection threads. The permissible values are
no-threads(the server uses a single thread to handle one connection) andone-thread-per-connection(the server uses one thread to handle each client connection).no-threadsis useful for debugging under Linux; see Section 28.5, “Debugging and Porting MySQL”. -
Command-Line Format --thread-stack=#System Variable Name thread_stackVariable Scope Global Dynamic Variable No Permitted Values (32-bit platforms) Type integer Default 196608Min Value 131072Max Value 4294967295Block Size 1024Permitted Values (64-bit platforms) Type integer Default 262144Min Value 131072Max Value 18446744073709551615Block Size 1024The stack size for each thread. The default of 192KB (256KB for 64-bit systems) is large enough for normal operation. If the thread stack size is too small, it limits the complexity of the SQL statements that the server can handle, the recursion depth of stored procedures, and other memory-consuming actions.
This variable is unused. It is deprecated and will be removed in a future MySQL release.
-
System Variable Name time_zoneVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type string The current time zone. This variable is used to initialize the time zone for each client that connects. By default, the initial value of this is
'SYSTEM'(which means, “use the value ofsystem_time_zone”). The value can be specified explicitly at server startup with the--default-time-zoneoption. See Section 10.6, “MySQL Server Time Zone Support”. -
System Variable Name timestampVariable Scope Session Dynamic Variable Yes Permitted Values Type numeric Set the time for this client. This is used to get the original timestamp if you use the binary log to restore rows.
timestamp_valueshould be a Unix epoch timestamp (a value like that returned byUNIX_TIMESTAMP(), not a value in'YYYY-MM-DD hh:mm:ss'format) orDEFAULT.Setting
timestampto a constant value causes it to retain that value until it is changed again. SettingtimestamptoDEFAULTcauses its value to be the current date and time as of the time it is accessed.In MySQL 8.0,
timestampis aDOUBLErather thanBIGINTbecause its value includes a microseconds part.SET timestampaffects the value returned byNOW()but not bySYSDATE(). This means that timestamp settings in the binary log have no effect on invocations ofSYSDATE(). The server can be started with the--sysdate-is-nowoption to causeSYSDATE()to be an alias forNOW(), in which caseSET timestampaffects both functions. -
Command-Line Format --tls-version=protocol_listSystem Variable Name tls_versionVariable Scope Global Dynamic Variable No Permitted Values (OpenSSL) Type string Default TLSv1,TLSv1.1,TLSv1.2Permitted Values (yaSSL) Type string Default TLSv1,TLSv1.1The protocols permitted by the server for encrypted connections. The value is a comma-separated list containing one or more protocol names. The protocols that can be named for this variable depend on the SSL library used to compile MySQL. For details, see Section 6.4.3, “Secure Connection Protocols and Ciphers”.
-
Command-Line Format --tmp-table-size=#System Variable Name tmp_table_sizeVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default 16777216Min Value 1024Max Value 18446744073709551615The maximum size of internal in-memory temporary tables. This variable does not apply to user-created
MEMORYtables.The actual limit is determined from whichever of the values of
tmp_table_sizeandmax_heap_table_sizeis smaller. If an in-memory temporary table exceeds the limit, MySQL automatically converts it to an on-disk temporary table. Theinternal_tmp_disk_storage_engineoption defines the storage engine used for on-disk temporary tables.Increase the value of
tmp_table_size(andmax_heap_table_sizeif necessary) if you do many advancedGROUP BYqueries and you have lots of memory.You can compare the number of internal on-disk temporary tables created to the total number of internal temporary tables created by comparing the values of the
Created_tmp_disk_tablesandCreated_tmp_tablesvariables.See also Section 8.4.4, “Internal Temporary Table Use in MySQL”.
-
Command-Line Format --tmpdir=dir_nameSystem Variable Name tmpdirVariable Scope Global Dynamic Variable No Permitted Values Type directory name The directory used for temporary files and temporary tables. This variable can be set to a list of several paths that are used in round-robin fashion. Paths should be separated by colon characters (
:) on Unix and semicolon characters (;) on Windows.The multiple-directory feature can be used to spread the load between several physical disks. If the MySQL server is acting as a replication slave, you should not set
tmpdirto point to a directory on a memory-based file system or to a directory that is cleared when the server host restarts. A replication slave needs some of its temporary files to survive a machine restart so that it can replicate temporary tables orLOAD DATA INFILEoperations. If files in the temporary file directory are lost when the server restarts, replication fails. You can set the slave's temporary directory using theslave_load_tmpdirvariable. In that case, the slave will not use the generaltmpdirvalue and you can settmpdirto a nonpermanent location. -
Command-Line Format --transaction-alloc-block-size=#System Variable Name transaction_alloc_block_sizeVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default 8192Min Value 1024Max Value 131072Block Size 1024The amount in bytes by which to increase a per-transaction memory pool which needs memory. See the description of
transaction_prealloc_size. -
Command-Line Format --transaction-prealloc-size=#System Variable Name transaction_prealloc_sizeVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type integer Default 4096Min Value 1024Max Value 131072Block Size 1024There is a per-transaction memory pool from which various transaction-related allocations take memory. The initial size of the pool in bytes is
transaction_prealloc_size. For every allocation that cannot be satisfied from the pool because it has insufficient memory available, the pool is increased bytransaction_alloc_block_sizebytes. When the transaction ends, the pool is truncated totransaction_prealloc_sizebytes.By making
transaction_prealloc_sizesufficiently large to contain all statements within a single transaction, you can avoid manymalloc()calls. transaction_write_set_extractionCommand-Line Format --transaction-write-set-extraction=[value]System Variable Name transaction_write_set_extractionVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type enumeration Default OFFValid Values OFFMURMUR32XXHASH64Permitted Values (>= 8.0.2) Type enumeration Default XXHASH64Valid Values OFFMURMUR32XXHASH64Defines the algorithm used to hash the writes extracted during a transaction. If you are using Group Replication, this variable must be set to
XXHASH64because the process of extracting the writes from a transaction is required for conflict detection on all group members. See Section 21.7.1, “Group Replication Requirements”.NoteThe value of this variable cannot be changed when
binlog_transaction_dependency_trackingis set to either ofWRITESETorWRITESET_SESSION.-
System Variable Name tx_isolationVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type enumeration Default REPEATABLE-READValid Values READ-UNCOMMITTEDREAD-COMMITTEDREPEATABLE-READSERIALIZABLEThe default transaction isolation level. Defaults to
REPEATABLE-READ.This variable can be set directly, or indirectly using the
SET TRANSACTIONstatement. See Section 13.3.6, “SET TRANSACTION Syntax”. If you settx_isolationdirectly to an isolation level name that contains a space, the name should be enclosed within quotation marks, with the space replaced by a dash. For example:SET tx_isolation = 'READ-COMMITTED';Any unique prefix of a valid value may be used to set the value of this variable.
The default transaction isolation level can also be set at startup using the
--transaction-isolationserver option. -
System Variable Name tx_read_onlyVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type boolean Default OFFThe default transaction access mode. The value can be
OFF(read/write, the default) orON(read only).This variable can be set directly, or indirectly using the
SET TRANSACTIONstatement. See Section 13.3.6, “SET TRANSACTION Syntax”.To set the default transaction access mode at startup, use the
--transaction-read-onlyserver option. -
System Variable Name unique_checksVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type boolean Default 1If set to 1 (the default), uniqueness checks for secondary indexes in
InnoDBtables are performed. If set to 0, storage engines are permitted to assume that duplicate keys are not present in input data. If you know for certain that your data does not contain uniqueness violations, you can set this to 0 to speed up large table imports toInnoDB.Setting this variable to 0 does not require storage engines to ignore duplicate keys. An engine is still permitted to check for them and issue duplicate-key errors if it detects them.
-
Command-Line Format --updatable-views-with-limit=#System Variable Name updatable_views_with_limitVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type boolean Default 1This 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
LIMITclause. (Such updates often are generated by GUI tools.) An update is anUPDATEorDELETEstatement. Primary key here means aPRIMARY KEY, or aUNIQUEindex in which no column can containNULL.The variable can have two values:
1orYES: Issue a warning only (not an error message). This is the default value.0orNO: Prohibit the update.
validate_password_xxxThe
validate_passwordplugin implements a set of system variables having names of the formvalidate_password_. These variables affect password testing by that plugin; see Section 6.5.3.2, “Password Validation Plugin Options and Variables”.xxx-
System Variable Name validate_user_pluginsVariable Scope Global Dynamic Variable No Permitted Values Type boolean Default ONIf this variable is enabled (the default), the server checks each user account and produces a warning if conditions are found that would make the account unusable:
The account requires an authentication plugin that is not loaded.
The account requires the
sha256_passwordauthentication plugin but the server was started with neither SSL nor RSA enabled as required by this plugin.
Enabling
validate_user_pluginsslows down server initialization andFLUSH PRIVILEGES. If you do not require the additional checking, you can disable this variable at startup to avoid the performance decrement. The version number for the server. The value might also include a suffix indicating server build or configuration information.
-logindicates that one or more of the general log, slow query log, or binary log are enabled.-debugindicates that the server was built with debugging support enabled.-
System Variable Name version_commentVariable Scope Global Dynamic Variable No Permitted Values Type string The CMake configuration program has a
COMPILATION_COMMENToption that permits a comment to be specified when building MySQL. This variable contains the value of that comment. See Section 2.8.4, “MySQL Source-Configuration Options”. -
System Variable Name version_compile_machineVariable Scope Global Dynamic Variable No Permitted Values Type string The type of the server binary.
-
System Variable Name version_compile_osVariable Scope Global Dynamic Variable No Permitted Values Type string The type of operating system on which MySQL was built.
-
Command-Line Format --wait-timeout=#System Variable Name wait_timeoutVariable Scope Global, Session Dynamic Variable Yes Permitted Values (Windows) Type integer Default 28800Min Value 1Max Value 2147483Permitted Values (Other) Type integer Default 28800Min Value 1Max Value 31536000The number of seconds the server waits for activity on a noninteractive connection before closing it.
On thread startup, the session
wait_timeoutvalue is initialized from the globalwait_timeoutvalue or from the globalinteractive_timeoutvalue, depending on the type of client (as defined by theCLIENT_INTERACTIVEconnect option tomysql_real_connect()). See alsointeractive_timeout. The number of errors, warnings, and notes that resulted from the last statement that generated messages. This variable is read only. See Section 13.7.5.40, “SHOW WARNINGS Syntax”.
-
Introduced 8.0.2 Command-Line Format --windowing-use-high-precision=#System Variable Name windowing_use_high_precisionVariable Scope Global, Session Dynamic Variable Yes Permitted Values Type boolean Default ONWhether to compute window operations without loss of precision.
For some moving frame aggregates, the inverse aggregate function can be applied to remove values from the aggregate. This can improve performance but possibly with a loss of precision. For example, adding a very small floating-point value to a very large value causes the very small value to be “hidden” by the large value. When inverting the large value later, the effect of the small value is lost.
Loss of precision due to inverse aggregation is a factor only for operations on floating-point (approximate-value) data types. For other types, inverse aggregation is safe; this includes
DECIMAL, which permits a fractional part but is an exact-value type.For faster execution, MySQL always uses inverse aggregation when it is safe:
For floating-point values, inverse aggregation is not always safe and might result in loss of precision. The default is to avoid inverse aggregation, which is slower but preserves precision. If it is permissible to sacrifice safety for speed,
windowing_use_high_precisioncan be disabled to permit inverse aggregation.For nonfloating-point data types, inverse aggregation is always safe and is used regardless of the
windowing_use_high_precisionvalue.This variable has no effect on
MIN()andMAX(), which do not use inverse aggregation in any case.
[mysqld]
ft_min_word_len=3
you should also set
[myisamchk]
ft_min_word_len=3
if you use myisamchk
A value of 0 means that table & database names are stored as-is, and name comparisons are case sensitive.
There's more information about lower_case_table_names on this page:
http://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html
However, the fact that on 32-bit GNU/Linux x86, "sort_buffer_size" must be a few MiB only to avoid exceeding maximum process space, as explained in http://dev.mysql.com/doc/refman/5.0/en/innodb-configuration.html makes one infer that that sort_buffer_size is actually some kind of in-memory buffer.
Additionally, the formula should probably be extended:
total =
innodb_buffer_pool_size +
key_buffer_size +
innodb_additional_mem_pool_size +
innodb_log_buffer_size +
max_connections *
(sort_buffer_size +
read_buffer_size +
binlog_cache_size +
maximum_thread_stack_size);
Noting that "key_buffer_size" is a MyISAM parameter
http://www.geeksww.com/tutorials/database_management_systems/mysql/configuration/mysql_open_files_limit_openfileslimit_vs_openfileslimit_on_linux.php
This is not documented anywhere as far as I can tell, and I only found it after banging my head against a wall looking through the MySQL source code.
We've just upgraded some servers for our CRM systems and itv took us a while to work out why performance was slow!
John Paterson
http://www.reallysimplesystems.com/
Making CRM Simple