Personal tools
You are here: Home Docs MySQL 4.1 Chapter 5. MySQL Server Administration

Chapter 5. MySQL Server Administration

Chapter 5. MySQL Server Administration

Table of Contents

5.1. The MySQL Server
5.1.1. Server Option and Variable Reference
5.1.2. Server Command Options
5.1.3. Server System Variables
5.1.4. Session System Variables
5.1.5. Using System Variables
5.1.6. Server Status Variables
5.1.7. Server SQL Modes
5.1.8. Server-Side Help
5.1.9. Server Response to Signals
5.1.10. The Shutdown Process
5.2. The mysqld-max Extended MySQL Server
5.3. MySQL Server Logs
5.3.1. The Error Log
5.3.2. The General Query Log
5.3.3. The Update Log
5.3.4. The Binary Log
5.3.5. The Slow Query Log
5.3.6. Server Log Maintenance
5.4. General Security Issues
5.4.1. General Security Guidelines
5.4.2. Making MySQL Secure Against Attackers
5.4.3. Security-Related mysqld Options
5.4.4. Security Issues with LOAD DATA LOCAL
5.4.5. How to Run MySQL as a Normal User
5.5. The MySQL Access Privilege System
5.5.1. Privileges Provided by MySQL
5.5.2. Privilege System Grant Tables
5.5.3. Specifying Account Names
5.5.4. Access Control, Stage 1: Connection Verification
5.5.5. Access Control, Stage 2: Request Verification
5.5.6. When Privilege Changes Take Effect
5.5.7. Causes of Access-Denied Errors
5.6. MySQL User Account Management
5.6.1. User Names and Passwords
5.6.2. Adding User Accounts
5.6.3. Removing User Accounts
5.6.4. Limiting Account Resources
5.6.5. Assigning Account Passwords
5.6.6. Password Security in MySQL
5.6.7. Using SSL for Secure Connections
5.6.8. Connecting to MySQL Remotely from Windows with SSH
5.6.9. Auditing MySQL Account Activity
5.7. Running Multiple MySQL Servers on the Same Machine
5.7.1. Running Multiple Servers on Windows
5.7.2. Running Multiple Servers on Unix
5.7.3. Using Client Programs in a Multiple-Server Environment

End of Product LifecycleActive development and support for MySQL database server versions 3.23, 4.0, and 4.1 has ended. However, for MySQL 4.0 and 4.1, there is still extended support available. For details, see http://www.mysql.com/company/legal/lifecycle/#calendar. According to the MySQL Lifecycle Policy (see http://www.mysql.com/company/legal/lifecycle/#policy), only Security and Severity Level 1 issues will still be fixed for MySQL 4.0 and 4.1. Please consider upgrading to a recent version (MySQL 5.0 or 5.1).

MySQL Server (mysqld) is the main program that does most of the work in a MySQL installation. This section provides an overview of MySQL Server and covers topics that deal with administering a MySQL installation:

  • Server configuration

  • The server log files

  • Security issues and user-account management

  • Management of multiple servers on a single machine

5.1. The MySQL Server

mysqld is the MySQL server. The following discussion covers these MySQL server configuration topics:

  • Startup options that the server supports

  • Server system variables

  • Server status variables

  • How to set the server SQL mode

  • The server shutdown process

Note

Not all storage engines (also known in older versions of MySQL as “table types”) are supported by all MySQL server binaries and configurations. To find out how to determine which storage engines are supported by your MySQL server installation, see Section 12.5.5.10, “SHOW ENGINES Syntax”.

5.1.1. Server Option and Variable Reference

The following table provides a list of all the command line options, server and status variables applicable within mysqld.

The table lists command-line options (Cmd-line), options valid in configuration files (Option file), server system variables (System Var), and status variables (Status var) in one unified list, with notification of where each option/variable is valid. If a server option set on the command line or in an option file differs from the name of the corresponding server system or status variable, the variable name is noted immediately below the corresponding option. For status variables, the scope of the variable is shown (Scope) as either global, session, or both. Please see the corresponding sections for details on setting and using the options and variables. Where appropriate, a direct link to further information on the item as available.

Table 5.1. mysqld Option/Variable Summary

NameCmd-LineOption fileSystem VarStatus VarVar ScopeDynamic
abort-slave-event-countYesYes    
Aborted_clients   YesGlobalNo
Aborted_connects   YesGlobalNo
allow-suspicious-udfsYesYes    
ansiYesYes    
autocommit  Yes SessionYes
back_logYesYesYes GlobalNo
basedirYesYesYes GlobalNo
bdb_cache_sizeYesYesYes GlobalNo
bdb-homeYesYes  GlobalNo
- Variable: bdb_home  Yes GlobalNo
bdb-lock-detectYesYes  GlobalNo
- Variable: bdb_lock_detect  Yes GlobalNo
bdb_log_buffer_sizeYesYesYes GlobalNo
bdb-logdirYesYes  GlobalNo
- Variable: bdb_logdir  Yes GlobalNo
bdb_max_lockYesYesYes GlobalNo
bdb-no-recoverYesYes    
bdb-no-syncYesYes    
bdb-shared-dataYesYes  GlobalNo
- Variable: bdb_shared_data  Yes GlobalNo
bdb-tmpdirYesYes  GlobalNo
- Variable: bdb_tmpdir  Yes GlobalNo
big-tablesYesYes  SessionYes
- Variable: big_tables  Yes SessionYes
bind-addressYesYes    
Binlog_cache_disk_use   YesGlobalNo
binlog_cache_sizeYesYesYes GlobalYes
Binlog_cache_use   YesGlobalNo
binlog-do-dbYesYes    
binlog-ignore-dbYesYes    
bootstrapYesYes    
bulk_insert_buffer_sizeYesYesYes BothYes
Bytes_received   YesBothNo
Bytes_sent   YesBothNo
character_setYes Yes  No
character_set_client  Yes BothYes
character-set-client-handshakeYesYes    
character_set_connection  Yes BothYes
character_set_database[a]  Yes BothYes
character_set_results  Yes BothYes
character-set-serverYesYes  BothYes
- Variable: character_set_server  Yes BothYes
character_set_system  Yes GlobalNo
character-sets-dirYesYes  GlobalNo
- Variable: character_sets_dir  Yes GlobalNo
chrootYesYes    
collation_connection  Yes BothYes
collation_database[b]  Yes BothYes
collation-serverYesYes  BothYes
- Variable: collation_server  Yes BothYes
Com_admin_commands   YesBothNo
Com_alter_db   YesBothNo
Com_alter_table   YesBothNo
Com_analyze   YesBothNo
Com_backup_table   YesBothNo
Com_begin   YesBothNo
Com_change_db   YesBothNo
Com_change_master   YesBothNo
Com_check   YesBothNo
Com_checksum   YesBothNo
Com_commit   YesBothNo
Com_create_db   YesBothNo
Com_create_index   YesBothNo
Com_create_table   YesBothNo
Com_dealloc_sql   YesBothNo
Com_delete   YesBothNo
Com_delete_multi   YesBothNo
Com_do   YesBothNo
Com_drop_db   YesBothNo
Com_drop_index   YesBothNo
Com_drop_table   YesBothNo
Com_drop_user   YesBothNo
Com_execute_sql   YesBothNo
Com_flush   YesBothNo
Com_grant   YesBothNo
Com_ha_close   YesBothNo
Com_ha_open   YesBothNo
Com_ha_read   YesBothNo
Com_help   YesBothNo
Com_insert   YesBothNo
Com_insert_select   YesBothNo
Com_kill   YesBothNo
Com_load   YesBothNo
Com_load_master_data   YesBothNo
Com_load_master_table   YesBothNo
Com_lock_tables   YesBothNo
Com_optimize   YesBothNo
Com_preload_keys   YesBothNo
Com_prepare_sql   YesBothNo
Com_rename_table   YesBothNo
Com_repair   YesBothNo
Com_replace   YesBothNo
Com_replace_select   YesBothNo
Com_reset   YesBothNo
Com_restore_table   YesBothNo
Com_revoke   YesBothNo
Com_revoke_all   YesBothNo
Com_rollback   YesBothNo
Com_savepoint   YesBothNo
Com_select   YesBothNo
Com_set_option   YesBothNo
Com_show_binlog_events   YesBothNo
Com_show_binlogs   YesBothNo
Com_show_charsets   YesBothNo
Com_show_collations   YesBothNo
Com_show_column_types   YesBothNo
Com_show_create_db   YesBothNo
Com_show_create_event   YesBothNo
Com_show_create_table   YesBothNo
Com_show_databases   YesBothNo
Com_show_engine_logs   YesBothNo
Com_show_engine_mutex   YesBothNo
Com_show_engine_status   YesBothNo
Com_show_errors   YesBothNo
Com_show_fields   YesBothNo
Com_show_grants   YesBothNo
Com_show_innodb_status   YesBothNo
Com_show_keys   YesBothNo
Com_show_logs   YesBothNo
Com_show_master_status   YesBothNo
Com_show_ndb_status   YesBothNo
Com_show_new_master   YesBothNo
Com_show_open_tables   YesBothNo
Com_show_privileges   YesBothNo
Com_show_processlist   YesBothNo
Com_show_slave_hosts   YesBothNo
Com_show_slave_status   YesBothNo
Com_show_status   YesBothNo
Com_show_storage_engines   YesBothNo
Com_show_tables   YesBothNo
Com_show_variables   YesBothNo
Com_show_warnings   YesBothNo
Com_slave_start   YesBothNo
Com_slave_stop   YesBothNo
Com_stmt_close   YesBothNo
Com_stmt_execute   YesBothNo
Com_stmt_fetch   YesBothNo
Com_stmt_prepare   YesBothNo
Com_stmt_reset   YesBothNo
Com_stmt_send_long_data   YesBothNo
Com_truncate   YesBothNo
Com_unlock_tables   YesBothNo
Com_update   YesBothNo
Com_update_multi   YesBothNo
concurrent_insertYesYesYes GlobalYes
connect_timeoutYesYesYes GlobalYes
consoleYesYes    
core-fileYesYes    
crash_binlog_innodbYesYes    
Created_tmp_disk_tables   YesBothNo
Created_tmp_files   YesGlobalNo
Created_tmp_tables   YesBothNo
datadirYesYesYes GlobalNo
date_format  Yes BothYes
datetime_formatYesYesYes BothYes
debugYesYesYes BothYes
default-character-setYesYes    
default-collationYes Yes  No
default-storage-engineYesYes    
default-table-typeYesYes    
default-time-zoneYesYes    
default_week_formatYesYesYes BothYes
defaults-extra-fileYes     
defaults-fileYes     
delay-key-writeYesYes  GlobalYes
- Variable: delay_key_write  Yes GlobalYes
delayed_insert_limitYesYesYes GlobalYes
delayed_insert_timeoutYesYesYes GlobalYes
delayed_queue_sizeYesYesYes GlobalYes
des-key-fileYesYes    
disconnect-slave-event-countYesYes    
enable-lockingYesYes    
enable-pstackYesYes    
error_count  Yes SessionNo
exit-infoYesYes    
expire_logs_daysYesYesYes GlobalYes
external-lockingYesYes    
- Variable: skip_external_locking      
flushYesYesYes GlobalYes
flush_timeYesYesYes GlobalYes
foreign_key_checks  Yes SessionYes
ft_boolean_syntaxYesYesYes GlobalYes
ft_max_word_lenYesYesYes GlobalNo
ft_min_word_lenYesYesYes GlobalNo
ft_query_expansion_limitYesYesYes GlobalNo
ft_stopword_fileYesYesYes GlobalNo
gdbYesYes    
group_concat_max_lenYesYesYes BothYes
Handler_commit   YesBothNo
Handler_delete   YesBothNo
Handler_discover   YesBothNo
Handler_read_first   YesBothNo
Handler_read_key   YesBothNo
Handler_read_next   YesBothNo
Handler_read_prev   YesBothNo
Handler_read_rnd   YesBothNo
Handler_read_rnd_next   YesBothNo
Handler_rollback   YesBothNo
Handler_update   YesBothNo
Handler_write   YesBothNo
have_archive  Yes GlobalNo
have_bdb  Yes GlobalNo
have_blackhole_engine  Yes GlobalNo
have_compress  Yes GlobalNo
have_crypt  Yes GlobalNo
have_csv  Yes GlobalNo
have_example_engine  Yes GlobalNo
have_geometry  Yes GlobalNo
have_innodb  Yes GlobalNo
have_isam  Yes GlobalNo
have_merge_engine  Yes GlobalNo
have_ndbcluster  Yes GlobalNo
have_openssl  Yes GlobalNo
have_query_cache  Yes GlobalNo
have_raid  Yes GlobalNo
have_rtree_keys  Yes GlobalNo
have_symlink  Yes GlobalNo
helpYesYes    
identity  Yes SessionYes
init_connectYesYesYes GlobalYes
init-fileYesYes  GlobalNo
- Variable: init_file  Yes GlobalNo
init_slaveYesYesYes GlobalYes
innodbYesYes    
innodb_additional_mem_pool_sizeYesYesYes GlobalNo
innodb_autoextend_incrementYesYesYes GlobalYes
innodb_buffer_pool_awe_mem_mbYesYesYes GlobalNo
innodb_buffer_pool_sizeYesYesYes GlobalNo
innodb_data_file_pathYesYesYes GlobalNo
innodb_data_home_dirYesYesYes GlobalNo
innodb_fast_shutdownYesYesYes GlobalYes
innodb_file_io_threadsYesYesYes GlobalNo
innodb_file_per_tableYesYesYes GlobalNo
innodb_flush_log_at_trx_commitYesYesYes GlobalYes
innodb_flush_methodYesYesYes GlobalNo
innodb_force_recoveryYesYesYes GlobalNo
innodb_lock_wait_timeoutYesYesYes GlobalNo
innodb_locks_unsafe_for_binlogYesYesYes GlobalNo
innodb_log_arch_dirYesYesYes GlobalNo
innodb_log_archiveYesYesYes GlobalNo
innodb_log_buffer_sizeYesYesYes GlobalNo
innodb_log_file_sizeYesYesYes GlobalNo
innodb_log_files_in_groupYesYesYes GlobalNo
innodb_log_group_home_dirYesYesYes GlobalNo
innodb_max_dirty_pages_pctYesYesYes GlobalYes
innodb_max_purge_lagYesYesYes GlobalYes
innodb_mirrored_log_groupsYesYesYes GlobalNo
innodb_open_filesYesYesYes GlobalNo
innodb_safe_binlogYesYes    
innodb_status_fileYesYes    
innodb_table_locksYesYesYes BothYes
innodb_thread_concurrencyYesYesYes GlobalYes
insert_id  Yes SessionYes
interactive_timeoutYesYesYes BothYes
isamYesYesYes  No
join_buffer_sizeYesYesYes BothYes
Key_blocks_not_flushed   YesGlobalNo
Key_blocks_unused   YesGlobalNo
Key_blocks_used   YesGlobalNo
key_buffer_sizeYesYesYes GlobalYes
key_cache_age_thresholdYesYesYes GlobalYes
key_cache_block_sizeYesYesYes GlobalYes
key_cache_division_limitYesYesYes GlobalYes
Key_read_requests   YesGlobalNo
Key_reads   YesGlobalNo
Key_write_requests   YesGlobalNo
Key_writes   YesGlobalNo
languageYesYesYes GlobalNo
last_insert_id  Yes SessionYes
lc_time_names  Yes BothYes
license  Yes GlobalNo
local_infile  Yes GlobalYes
local-infileYesYes    
- Variable: local_infile      
locked_in_memory  Yes GlobalNo
logYesYesYes GlobalNo
log_bin  Yes GlobalNo
log-binYesYesYes GlobalNo
log-bin-indexYesYes    
log-errorYesYes  GlobalNo
- Variable: log_error  Yes GlobalNo
log-isamYesYes    
log-long-formatYesYes    
log-queries-not-using-indexesYesYes  GlobalYes
- Variable: log_queries_not_using_indexes  Yes GlobalYes
log-short-formatYesYes    
log-slave-updatesYesYes  GlobalNo
- Variable: log_slave_updates  Yes GlobalNo
log-slow-admin-statementsYesYes    
log-slow-queriesYesYes  GlobalNo
- Variable: log_slow_queries  Yes GlobalNo
log-updateYes     
- Variable: log_update      
log-warningsYesYes  BothYes
- Variable: log_warnings  Yes BothYes
long_query_timeYesYesYes BothYes
low-priority-updatesYesYes  BothYes
- Variable: low_priority_updates  Yes BothYes
lower_case_file_systemYesYesYes GlobalNo
lower_case_table_namesYesYesYes GlobalNo
master-connect-retryYesYes    
master-hostYesYes    
master-info-fileYesYes    
master-passwordYesYes    
master-portYesYes    
master-retry-countYesYes    
master-sslYesYes    
master-ssl-caYesYes    
master-ssl-capathYesYes    
master-ssl-certYesYes    
master-ssl-cipherYesYes    
master-ssl-keyYesYes    
master-userYesYes    
max_allowed_packetYesYesYes BothYes
max_binlog_cache_sizeYesYesYes GlobalYes
max-binlog-dump-eventsYesYes    
max_binlog_sizeYesYesYes GlobalYes
max_connect_errorsYesYesYes GlobalYes
max_connectionsYesYesYes GlobalYes
max_delayed_threadsYesYesYes BothYes
max_error_countYesYesYes BothYes
max_heap_table_sizeYesYesYes BothYes
max_insert_delayed_threads  Yes BothYes
max_join_sizeYesYesYes BothYes
max_length_for_sort_dataYesYesYes BothYes
max_prepared_stmt_countYesYesYes GlobalYes
max_relay_log_sizeYesYesYes GlobalYes
max_seeks_for_keyYesYesYes BothYes
max_sort_lengthYesYesYes BothYes
max_tmp_tablesYesYesYes BothYes
Max_used_connections   YesGlobalNo
max_user_connectionsYesYesYes GlobalYes
max_write_lock_countYesYesYes GlobalYes
memlockYesYesYes GlobalNo
mergeYesYes    
myisam-block-sizeYesYes    
myisam_data_pointer_sizeYesYesYes GlobalYes
myisam_max_extra_sort_file_sizeYesYesYes GlobalNo
myisam_max_sort_file_sizeYesYesYes GlobalYes
myisam-recoverYesYes    
myisam_recover_options  Yes GlobalNo
myisam_repair_threadsYesYesYes BothYes
myisam_sort_buffer_sizeYesYesYes BothYes
myisam_stats_methodYesYesYes BothYes
named_pipe  Yes GlobalNo
ndb_autoincrement_prefetch_szYesYesYes BothYes
ndb_cache_check_timeYesYesYes GlobalYes
ndb_force_sendYesYesYes BothYes
ndb_index_stat_cache_entriesYesYes    
ndb_index_stat_enableYesYes    
ndb_index_stat_update_freqYesYes    
ndb_optimized_node_selectionYesYes    
ndb_report_thresh_binlog_epoch_slipYesYes    
ndb_report_thresh_binlog_mem_usageYesYes    
ndb_use_exact_count  Yes BothYes
ndb_use_transactionsYesYes    
ndbclusterYesYes    
net_buffer_lengthYesYesYes BothYes
net_read_timeoutYesYesYes BothYes
net_retry_countYesYesYes BothYes
net_write_timeoutYesYesYes BothYes
newYesYesYes BothYes
no-defaultsYes     
Not_flushed_delayed_rows   YesGlobalNo
old-passwordsYesYes  BothYes
- Variable: old_passwords  Yes BothYes
old-protocolYesYes    
Open_files   YesGlobalNo
open-files-limitYesYes  GlobalNo
- Variable: open_files_limit  Yes GlobalNo
Open_streams   YesGlobalNo
Open_tables   YesBothNo
Opened_tables   YesBothNo
pid-fileYesYes  GlobalNo
- Variable: pid_file  Yes GlobalNo
plugin_dirYesYesYes GlobalNo
portYesYesYes GlobalNo
preload_buffer_sizeYesYesYes BothYes
Prepared_stmt_count   YesGlobalNo
prepared_stmt_count  Yes BothNo
print-defaultsYes     
protocol_version  Yes GlobalNo
pseudo_thread_id  Yes BothYes
Qcache_free_blocks   YesGlobalNo
Qcache_free_memory   YesGlobalNo
Qcache_hits   YesGlobalNo
Qcache_inserts   YesGlobalNo
Qcache_lowmem_prunes   YesGlobalNo
Qcache_not_cached   YesGlobalNo
Qcache_queries_in_cache   YesGlobalNo
Qcache_total_blocks   YesGlobalNo
query_alloc_block_sizeYesYesYes BothYes
query_cache_limitYesYesYes GlobalYes
query_cache_min_res_unitYesYesYes GlobalYes
query_cache_sizeYesYesYes GlobalYes
query_cache_typeYesYesYes BothYes
query_cache_wlock_invalidateYesYesYes BothYes
query_prealloc_sizeYesYesYes BothYes
Questions   YesBothNo
rand_seed1  Yes SessionYes
rand_seed2  Yes SessionYes
range_alloc_block_sizeYesYesYes BothYes
read_buffer_sizeYesYesYes BothYes
read_onlyYesYesYes GlobalYes
read_rnd_buffer_sizeYesYesYes BothYes
relay-logYesYes    
relay-log-indexYesYes    
- Variable: relay_log_index      
relay-log-info-fileYesYes    
- Variable: relay_log_info_file      
relay_log_purgeYesYesYes GlobalYes
relay_log_space_limitYesYesYes GlobalNo
replicate-do-dbYesYes    
replicate-do-tableYesYes    
replicate-ignore-dbYesYes    
replicate-ignore-tableYesYes    
replicate-rewrite-dbYesYes    
replicate-same-server-idYesYes    
replicate-wild-do-tableYesYes    
replicate-wild-ignore-tableYesYes    
report-hostYesYes  GlobalNo
- Variable: report_host  Yes GlobalNo
report-passwordYesYes  GlobalNo
- Variable: report_password  Yes GlobalNo
report-portYesYes  GlobalNo
- Variable: report_port  Yes GlobalNo
report-userYesYes  GlobalNo
- Variable: report_user  Yes GlobalNo
rpl_recovery_rank  Yes GlobalYes
safe-modeYesYes    
safe-show-databaseYesYesYes GlobalYes
safe-user-createYesYes    
safemalloc-mem-limitYesYes    
secure-authYesYes  GlobalYes
- Variable: secure_auth  Yes GlobalYes
Select_full_join   YesBothNo
Select_full_range_join   YesBothNo
Select_range   YesBothNo
Select_range_check   YesBothNo
Select_scan   YesBothNo
server-idYesYes  GlobalYes
- Variable: server_id  Yes GlobalYes
set-variableYesYes    
shared_memory  Yes GlobalNo
shared_memory_base_name  Yes GlobalNo
show-slave-auth-infoYesYes    
skip-bdbYesYes    
skip-character-set-client-handshakeYesYes    
skip-concurrent-insertYesYes    
- Variable: concurrent_insert      
skip-external-lockingYesYes  GlobalNo
- Variable: skip_external_locking  Yes GlobalNo
skip-grant-tablesYesYes    
skip-host-cacheYesYes    
skip-innodbYesYes    
skip-isamYesYesYes  No
skip-lockingYesYes    
skip-log-warningsYes     
skip-name-resolveYesYes    
skip-networkingYesYes  GlobalNo
- Variable: skip_networking  Yes GlobalNo
skip-newYesYes    
skip-safemallocYesYes    
skip-show-databaseYesYes  GlobalNo
- Variable: skip_show_database  Yes GlobalNo
skip-slave-startYesYes    
skip-sslYesYes    
skip-stack-traceYesYes    
skip-symbolic-linksYes     
skip-symlinkYesYes    
skip-sync-bdb-logsYesYesYes GlobalNo
skip-thread-priorityYesYes    
slave_compressed_protocolYesYesYes GlobalYes
slave-load-tmpdirYesYes  GlobalNo
- Variable: slave_load_tmpdir  Yes GlobalNo
slave-net-timeoutYesYes  GlobalYes
- Variable: slave_net_timeout  Yes GlobalYes
Slave_open_temp_tables   YesGlobalNo
slave-skip-errorsYesYes  GlobalNo
- Variable: slave_skip_errors  Yes GlobalNo
slave_transaction_retriesYesYesYes GlobalYes
Slow_launch_threads   YesBothNo
slow_launch_timeYesYesYes GlobalYes
Slow_queries   YesBothNo
socketYesYesYes GlobalNo
sort_buffer_sizeYesYesYes BothYes
Sort_merge_passes   YesBothNo
Sort_range   YesBothNo
Sort_rows   YesBothNo
Sort_scan   YesBothNo
sporadic-binlog-dump-failYesYes    
sql_auto_is_null  Yes SessionYes
sql_big_selects  Yes BothYes
sql_big_tables  Yes SessionYes
sql-bin-update-sameYesYes    
sql_buffer_result  Yes SessionYes
sql_log_bin  Yes SessionYes
sql_log_off  Yes SessionYes
sql_log_update  Yes SessionYes
sql_low_priority_updates  Yes BothYes
sql_max_join_size  Yes BothYes
sql-modeYesYes  BothYes
- Variable: sql_mode  Yes BothYes
sql_notes  Yes SessionYes
sql_quote_show_create  Yes SessionYes
sql_safe_updates  Yes SessionYes
sql_select_limit  Yes BothYes
sql_slave_skip_counter  Yes GlobalYes
sql_warnings  Yes SessionYes
sslYesYes    
Ssl_accept_renegotiates   YesGlobalNo
Ssl_accepts   YesGlobalNo
ssl-caYesYes  GlobalNo
- Variable: ssl_ca  Yes GlobalNo
Ssl_callback_cache_hits   YesGlobalNo
ssl-capathYesYes  GlobalNo
- Variable: ssl_capath  Yes GlobalNo
ssl-certYesYes  GlobalNo
- Variable: ssl_cert  Yes GlobalNo
ssl-cipherYesYes  GlobalNo
- Variable: ssl_cipher  Yes GlobalNo
Ssl_cipher   YesBothNo
Ssl_cipher_list   YesBothNo
Ssl_client_connects   YesGlobalNo
Ssl_connect_renegotiates   YesGlobalNo
Ssl_ctx_verify_depth   YesGlobalNo
Ssl_ctx_verify_mode   YesGlobalNo
Ssl_default_timeout   YesBothNo
Ssl_finished_accepts   YesGlobalNo
Ssl_finished_connects   YesGlobalNo
ssl-keyYesYes  GlobalNo
- Variable: ssl_key  Yes GlobalNo
Ssl_session_cache_hits   YesGlobalNo
Ssl_session_cache_misses   YesGlobalNo
Ssl_session_cache_mode   YesGlobalNo
Ssl_session_cache_overflows   YesGlobalNo
Ssl_session_cache_size   YesGlobalNo
Ssl_session_cache_timeouts   YesGlobalNo
Ssl_sessions_reused   YesBothNo
Ssl_used_session_cache_entries   YesGlobalNo
Ssl_verify_depth   YesBothNo
Ssl_verify_mode   YesBothNo
Ssl_version   YesBothNo
standaloneYesYes    
storage_engine  Yes BothYes
symbolic-linksYesYes    
sync-bdb-logsYesYes  GlobalNo
- Variable: sync_bdb_logs  Yes GlobalNo
sync-binlogYesYes  GlobalYes
- Variable: sync_binlog  Yes GlobalYes
sync-frmYesYes  GlobalYes
- Variable: sync_frm  Yes GlobalYes
system_time_zone  Yes GlobalNo
Table_locks_immediate   YesGlobalNo
Table_locks_waited   YesGlobalNo
table_type  Yes BothYes
temp-poolYesYes    
thread_cache_sizeYesYesYes GlobalYes
thread_concurrencyYesYesYes GlobalNo
thread_stackYesYesYes GlobalNo
Threads_cached   YesGlobalNo
Threads_connected   YesGlobalNo
Threads_created   YesGlobalNo
Threads_running   YesGlobalNo
time_formatYesYesYes BothYes
time_zoneYesYesYes BothYes
timestamp  Yes SessionYes
tmp_table_sizeYesYesYes BothYes
tmpdirYesYesYes GlobalNo
transaction_alloc_block_sizeYesYesYes BothYes
transaction-isolationYesYes    
transaction_prealloc_sizeYesYesYes BothYes
tx_isolation  Yes BothYes
unique_checks  Yes SessionYes
Uptime   YesGlobalNo
userYesYes    
verboseYesYes    
versionYesYesYes GlobalNo
version_comment  Yes GlobalNo
version_compile_machine  Yes GlobalNo
version_compile_os  Yes GlobalNo
wait_timeoutYesYesYes BothYes
warning_count  Yes SessionNo
warningsYesYes    

[a] This option is dynamic, but only the server should set this information. You should not set the value of this variable manually.

[b] This option is dynamic, but only the server should set this information. You should not set the value of this variable manually.

5.1.2. Server Command Options

When you start the mysqld server, you can specify program options using any of the methods described in Section 4.2.3, “Specifying Program Options”. The most common methods are to provide options in an option file or on the command line. However, in most cases it is desirable to make sure that the server uses the same options each time it runs. The best way to ensure this is to list them in an option file. See Section 4.2.3.3, “Using Option Files”.

MySQL Enterprise For expert advice on setting command options, subscribe to the MySQL Enterprise Monitor. For more information, see http://www.mysql.com/products/enterprise/advisors.html.

mysqld reads options from the [mysqld] and [server] groups. mysqld_safe reads options from the [mysqld], [server], [mysqld_safe], and [safe_mysqld] groups. mysql.server reads options from the [mysqld] and [mysql.server] groups.

An embedded MySQL server usually reads options from the [server], [embedded], and [xxxxx_SERVER] groups, where xxxxx is the name of the application into which the server is embedded.

mysqld accepts many command options. For a list, execute mysqld --help. Before MySQL 4.1.1, --help prints the full help message. As of 4.1.1, it prints a brief message; to see the full list, use mysqld --verbose --help.

The following list shows some of the most common server options. Additional options are described in other sections:

You can also set the values of server system variables by using variable names as options, as described at the end of this section.

  • --help, -?

    Display a short help message and exit. Before MySQL 4.1.1, --help displays the full help message. As of 4.1.1, it displays an abbreviated message only. Use both the --verbose and --help options to see the full message.

  • --allow-suspicious-udfs

    This option controls whether user-defined functions that have only an xxx symbol for the main function can be loaded. By default, the option is off and only UDFs that have at least one auxiliary symbol can be loaded; this prevents attempts at loading functions from shared object files other than those containing legitimate UDFs. This option was added in MySQL 4.0.24, and 4.1.10a. See Section 18.2.2.6, “User-Defined Function Security Precautions”.

  • --ansi

    Use standard (ANSI) SQL syntax instead of MySQL syntax. For more precise control over the server SQL mode, use the --sql-mode option instead. See Section 1.7.3, “Running MySQL in ANSI Mode”, and Section 5.1.7, “Server SQL Modes”.

  • --basedir=path, -b path

    The path to the MySQL installation directory. All paths are usually resolved relative to this directory.

  • --big-tables

    Allow large result sets by saving all temporary sets in files. This option prevents most “table full” errors, but also slows down queries for which in-memory tables would suffice. Since MySQL 3.23.2, the server is able to handle large result sets automatically by using memory for small temporary tables and switching to disk tables where necessary.

  • --bind-address=IP

    The IP address to bind to. Only one address can be selected. If this option is specified multiple times, the last address given is used.

    If no address or 0.0.0.0 is specified, the server listens on all interfaces.

  • --bootstrap

    This option is used by the mysql_install_db script to create the MySQL privilege tables without having to start a full MySQL server.

  • --character-sets-dir=path

    The directory where character sets are installed. See Section 9.2, “The Character Set Used for Data and Sorting”.

  • --character-set-client-handshake

    Don't ignore character set information sent by the client. To ignore client information and use the default server character set, use --skip-character-set-client-handshake; this makes MySQL 4.1 and higher behave like MySQL 4.0. This option was added in MySQL 4.1.15.

  • --character-set-server=charset_name, -C charset_name

    Use charset_name as the default server character set. See Section 9.2, “The Character Set Used for Data and Sorting”. If you use this option to specify a nondefault character set, you should also use --collation-server to specify the collation. This option is available as of MySQL 4.1.3.

  • --chroot=path, -r path

    Put the mysqld server in a closed environment during startup by using the chroot() system call. This is a recommended security measure as of MySQL 4.0. (MySQL 3.23 is not able to provide a chroot() jail that is 100% closed.) Note that use of this option somewhat limits LOAD DATA INFILE and SELECT ... INTO OUTFILE.

  • --collation-server=collation_name

    Use collation_name as the default server collation. This option is available as of MySQL 4.1.3. See Section 9.2, “The Character Set Used for Data and Sorting”.

  • --console

    (Windows only.) Write error log messages to stderr and stdout even if --log-error is specified. mysqld does not close the console window if this option is used.

  • --core-file

    Write a core file if mysqld dies. The name and location of the core file is system dependent. On Linux, a core file named core.pid is written to the current working directory of the process, which for mysqld is the data directory. pid represents the process ID of the server process. On Mac OS X, a core file named core.pid is written to the /cores directory. On Solaris, use the coreadm command to specify where to write the core file and how to name it.

    For some systems, to get a core file you must also specify the --core-file-size option to mysqld_safe. See Section 4.3.2, “mysqld_safe — MySQL Server Startup Script”. On some systems, such as Solaris, you do not get a core file if you are also using the --user option. There might be additional restrictions or limitations. For example, it might be necessary to execute ulimit -c unlimited before starting the server. Consult your system documentation.

  • --datadir=path, -h path

    The path to the data directory.

  • --debug[=debug_options], -# [debug_options]

    If MySQL is configured with --with-debug, you can use this option to get a trace file of what mysqld is doing. A typical debug_options string is 'd:t:o,file_name'. The default is 'd:t:i:o,mysqld.trace'. See MySQL Internals: Porting.

  • --default-character-set=charset_name, -C charset_name

    Use charset_name as the default character set. This option is deprecated in favor of --character-set-server as of MySQL 4.1.3. See Section 9.2, “The Character Set Used for Data and Sorting”.

  • --default-collation=collation_name

    Use collation_name as the default collation. This option is deprecated in favor of --collation-server as of MySQL 4.1.3. See Section 9.2, “The Character Set Used for Data and Sorting”.

  • --default-storage-engine=type

    This option is a synonym for --default-table-type. It is available as of MySQL 4.1.2.

  • --default-table-type=type

    Set the default table type (storage engine) for tables. See Chapter 13, Storage Engines.

  • --default-time-zone=timezone

    Set the default server time zone. This option sets the global time_zone system variable. If this option is not given, the default time zone is the same as the system time zone (given by the value of the system_time_zone system variable. This option is available as of MySQL 4.1.3.

  • --delay-key-write[={OFF|ON|ALL}]

    Specify how to use delayed key writes. Delayed key writing causes key buffers not to be flushed between writes for MyISAM tables. OFF disables delayed key writes. ON enables delayed key writes for those tables that were created with the DELAY_KEY_WRITE option. ALL delays key writes for all MyISAM tables. Available as of MySQL 4.0.3. See Section 7.5.3, “Tuning Server Parameters”, and Section 13.1.1, “MyISAM Startup Options”.

    Note

    If you set this variable to ALL, you should not use MyISAM tables from within another program (such as another MySQL server or myisamchk) when the tables are in use. Doing so leads to index corruption.

  • --delay-key-write-for-all-tables

    Old form of --delay-key-write=ALL for use prior to MySQL 4.0.3. As of 4.0.3, use --delay-key-write instead.

  • --des-key-file=file_name

    Read the default DES keys from this file. These keys are used by the DES_ENCRYPT() and DES_DECRYPT() functions.

  • --enable-named-pipe

    Enable support for named pipes. This option applies only on Windows NT, 2000, XP, and 2003 systems, and can be used only with the mysqld-nt and mysqld-max-nt servers that support named-pipe connections.

  • --enable-pstack

    Print a symbolic stack trace on failure.

  • --exit-info[=flags], -T [flags]

    This is a bit mask of different flags that you can use for debugging the mysqld server. Do not use this option unless you know exactly what it does!

  • --external-locking

    Enable external locking (system locking), which is disabled by default as of MySQL 4.0. Note that if you use this option on a system on which lockd does not fully work (such as Linux), it is easy for mysqld to deadlock. This option was named --enable-locking before MySQL 4.0.3.

    For more information about external locking, including conditions under which it can and cannot be used, see Section 7.3.4, “External Locking”.

  • --flush

    Flush (synchronize) 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 A.1.4.2, “What to Do If MySQL Keeps Crashing”.

  • --gdb

    Install an interrupt handler for SIGINT (needed to stop mysqld with ^C to set breakpoints) and disable stack tracing and core file handling. See MySQL Internals: Porting. This option was added in MySQL 4.0.14.

  • --init-file=file_name

    Read SQL statements from this file at startup. Each statement must be on a single line and should not include comments.

  • --innodb_safe_binlog

    If this option is given, then after a crash recovery by InnoDB, mysqld truncates the binary log after the last not-rolled-back transaction in the log. The option also causes InnoDB to print an error if the binary log is smaller or shorter than it should be. See Section 5.3.4, “The Binary Log”.

  • --innodb-xxx

    The InnoDB options are listed in Section 13.2.4, “InnoDB Startup Options and System Variables”.

  • --language=lang_name, -L lang_name

    Return client error messages in the given language. lang_name can be given as the language name or as the full path name to the directory where the language files are installed. See Section 9.3, “Setting the Error Message Language”.

  • --log[=file_name], -l [file_name]

    Log connections and SQL statements received from clients to this file. See Section 5.3.2, “The General Query Log”. If you omit the file name, MySQL uses host_name.log as the file name.

  • --log-error[=file_name]

    Log errors and startup messages to this file. See Section 5.3.1, “The Error Log”. If you omit the file name, MySQL uses host_name.err. If the file name has no extension, the server adds an extension of .err.

  • --log-isam[=file_name]

    Log all ISAM/MyISAM changes to this file (used only when debugging ISAM/MyISAM).

  • --log-long-format

    Log extra information to the update log, binary update log, and slow query log, if they have been activated. For example, the user name and timestamp are logged for queries. Before MySQL 4.1, if you are using --log-slow-queries and --log-long-format, queries that are not using indexes also are logged to the slow query log. --log-long-format is deprecated as of MySQL version 4.1, when --log-short-format was introduced. (Long log format is the default setting since version 4.1.) Also note that starting with MySQL 4.1, the --log-queries-not-using-indexes option is available for the purpose of logging queries that do not use indexes to the slow query log.

  • --log-queries-not-using-indexes

    If you are using this option with the slow query log enabled, queries that are expected to retrieve all rows are logged. See Section 5.3.5, “The Slow Query Log”. This option does not necessarily mean that no index is used. For example, a query that uses a full index scan uses an index but would be logged because the index would not limit the number of rows. This option is available as of MySQL 4.1.

  • --log-short-format

    Originally intended to log less information to the update log, binary log and slow query log, if they have been activated. This option was introduced in MySQL 4.1, but is not operational.

  • --log-slow-admin-statements

    Log slow administrative statements such as OPTIMIZE TABLE, ANALYZE TABLE, and ALTER TABLE to the slow query log.

    This option was added in MySQL 4.1.13. (It is unnecessary in MySQL 4.0 because slow administrative statements are logged by default.)

  • --log-slow-queries[=file_name]

    Log all queries that have taken more than long_query_time seconds to execute to this file. See Section 5.3.5, “The Slow Query Log”. Note that the default for the amount of information logged has changed in MySQL 4.1. See the --log-long-format and --log-short-format options for details.

  • --log-update[=file_name]

    Log updates to fileN where N is a unique number if not given. See Section 5.3.3, “The Update Log”. The update log is now deprecated; you should use the binary log instead (--log-bin). See Section 5.3.4, “The Binary Log”.

  • --log-warnings[=level], -W [level]

    Print out warnings such as Aborted connection... to the error log. Enabling this option is recommended, for example, if you use replication (you get more information about what is happening, such as messages about network failures and reconnections). This option is enabled by default as of MySQL 4.0.19 and 4.1.2; to disable it, use --log-warnings=0. As of MySQL 4.0.21 and 4.1.3, a level argument can be given. If omitted, the default level is 1. If the value is greater than 1, aborted connections are written to the error log. See Section A.1.2.11, “Communication Errors and Aborted Connections”.

    If a slave server was started with --log-warnings enabled, 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.

    Before MySQL 4.0.21 and 4.1.3, this is a boolean option, not an integer-valued option. Before 4.0, this option was named --warnings.

  • --low-priority-updates

    Give table-modifying operations (INSERT, REPLACE, DELETE, UPDATE) lower priority than selects. This can also be done via {INSERT | REPLACE | DELETE | UPDATE} LOW_PRIORITY ... to lower the priority of only one query, or by SET LOW_PRIORITY_UPDATES=1 to change the priority in one thread. This affects only storage engines that use only table-level locking (MyISAM, MEMORY, MERGE). See Section 7.3.2, “Table Locking Issues”.

  • --memlock

    Lock the mysqld process in memory. This option might help if you have a problem where the operating system is causing mysqld to swap to disk.

    --memlock works on systems that support the mlockall() system call; this includes Solaris as well as most Linux distributions that use a 2.4 or newer kernel. On Linux systems, you can tell whether or not mlockall() (and thus this option) is supported by checking to see whether or not it is defined in the system mman.h file, like this:

    shell> grep mlockall /usr/include/sys/mman.h
    

    If mlockall() is supported, you should see in the output of the previous command something like the following:

    extern int mlockall (int __flags) __THROW;
    

    Important

    Using this option requires that you run the server as root, which, for reasons of security, is normally not a good idea. See Section 5.4.5, “How to Run MySQL as a Normal User”.

    You must not try to use this option on a system that does not support the mlockall() system call; if you do so, mysqld will very likely crash as soon as you try to start it.

  • --myisam-block-size=N

    The block size to be used for MyISAM index pages.

  • --myisam-recover[=option[,option]...]]

    Set the MyISAM storage engine recovery mode. The option value is any combination of the values of DEFAULT, BACKUP, FORCE, or QUICK. If you specify multiple values, separate them by commas. You can also use a value of "" to disable this option. If this option is used, each time mysqld opens a MyISAM table, it checks whether the table is marked as crashed or wasn't closed properly. (The last option works only if you are running with external locking disabled.) If this is the case, mysqld runs a check on the table. If the table was corrupted, mysqld attempts to repair it.

    The following options affect how the repair works.

    OptionDescription
    DEFAULTRecovery without backup, forcing, or quick checking.
    BACKUPIf the data file was changed during recovery, save a backup of the tbl_name.MYD file as tbl_name-datetime.BAK.
    FORCERun recovery even if we would lose more than one row from the .MYD file.
    QUICKdo not check the rows in the table if there are not any delete blocks.

    Before the server automatically repairs a table, it writes a note about the repair to the error log. If you want to be able to recover from most problems without user intervention, you should use the options BACKUP,FORCE. This forces a repair of a table even if some rows would be deleted, but it keeps the old data file as a backup so that you can later examine what happened.

    See Section 13.1.1, “MyISAM Startup Options”.

    This option is available as of MySQL 3.23.25.

  • --new

    The --new option can be used to make the server behave as 4.1 in certain respects, easing a 4.0 to 4.1 upgrade:

    • Hexadecimal strings such as 0xFF are treated as strings by default rather than as numbers. (Works in 4.0.12 and up.)

    • TIMESTAMP is returned as a string with the format 'YYYY-MM-DD HH:MM:SS'. (Works in 4.0.13 and up.) See Chapter 10, Data Types.

    This option can be used to help you see how your applications behave in MySQL 4.1, without actually upgrading to 4.1.

  • --old-passwords

    Force the server to generate short (pre-4.1) password hashes for new passwords. This is useful for compatibility when the server must support older client programs. See Section 5.6.6.3, “Password Hashing in MySQL”.

  • --old-protocol, -o

    Use the 3.20 protocol for compatibility with some very old clients. This option was removed in MySQL 4.1.1.

  • --one-thread

    Only use one thread (for debugging under Linux). This option is available only if the server is built with debugging enabled. See MySQL Internals: Porting.

  • --open-files-limit=count

    Changes the number of file descriptors available to mysqld. You should try increasing the value of this option if mysqld gives you the error Too many open files. mysqld uses the option value to reserve descriptors with setrlimit(). If the requested number of file descriptors cannot be allocated, mysqld writes a warning to the error log.

    mysqld may attempt to allocate more than the requested number of descriptors (if they are available), using the values of max_connections and table_cache to estimate whether more descriptors will be needed.

  • --pid-file=path

    The path name of the process ID file. This file is used by other programs such as mysqld_safe to determine the server's process ID.

  • --port=port_num, -P port_num

    The port number to use when listening for TCP/IP connections. The port number must be 1024 or higher unless the server is started by the root system user.

  • --safe-mode

    Skip some optimization stages.

  • --safe-show-database

    With this option, the SHOW DATABASES statement displays only the names of those databases for which the user has some kind of privilege. As of MySQL 4.0.2, this option is deprecated and does not do anything (it is enabled by default), because there is a SHOW DATABASES privilege that can be used to control access to database names on a per-account basis. See Section 5.5.1, “Privileges Provided by MySQL”.

  • --safe-user-create

    If this option is enabled, a user cannot create new MySQL users by using the GRANT statement, if the user doesn't have the INSERT privilege for the mysql.user table or any column in the table.

  • --secure-auth

    Disallow authentication by clients that attempt to use accounts that have old (pre-4.1) passwords. This option is available as of MySQL 4.1.1.

  • --shared-memory

    Enable shared-memory connections by local clients. This option is available only on Windows. It was added in MySQL 4.1.0.

  • --shared-memory-base-name=name

    The name of shared memory to use for shared-memory connections. This option is available only on Windows. The default name is MYSQL. The name is case sensitive. This option was added in MySQL 4.1.0.

  • --skip-bdb

    Disable the BDB storage engine. This saves memory and might speed up some operations. Do not use this option if you require BDB tables.

  • --skip-concurrent-insert

    Turn off the ability to select and insert at the same time on MyISAM tables. (This is to be used only if you think you have found a bug in this feature.) See Section 7.3.3, “Concurrent Inserts”.

  • --skip-delay-key-write

    Ignore the DELAY_KEY_WRITE option for all tables. As of MySQL 4.0.3, you should use --delay-key-write=OFF instead. See Section 7.5.3, “Tuning Server Parameters”.

  • --skip-external-locking

    Do not use external locking (system locking). For more information about external locking, including conditions under which it can and cannot be used, see Section 7.3.4, “External Locking”.

    External locking has been disabled by default since MySQL 4.0.

  • --skip-grant-tables

    This option causes the server to start without using the privilege system at all, which gives anyone with access to the server unrestricted access to all databases. You can cause a running server to start using the grant tables again by executing mysqladmin flush-privileges or mysqladmin reload command from a system shell, or by issuing a MySQL FLUSH PRIVILEGES statement after connecting to the server. This option also suppresses loading of user-defined functions (UDFs).

  • --skip-host-cache

    Do not use the internal host name cache for faster name-to-IP resolution. Instead, query the DNS server every time a client connects. See Section 7.5.9, “How MySQL Uses DNS”.

  • --skip-innodb

    Disable the InnoDB storage engine. This saves memory and disk space and might speed up some operations. Do not use this option if you require InnoDB tables.

  • --skip-isam

    Disable the ISAM storage engine. As of MySQL 4.1, ISAM is disabled by default, so this option applies only if the server was configured with support for ISAM. This option was added in MySQL 4.1.1.

  • --skip-merge

    Disable the MERGE storage engine. This option was added in MySQL 4.1.21. It can be used if the following behavior is undesirable: If a user has access to MyISAM table t, that user can create a MERGE table m that accesses t. However, if the user's privileges on t are subsequently revoked, the user can continue to access t by doing so through m.

  • --skip-name-resolve

    Do not resolve host names when checking client connections. Use only IP numbers. If you use this option, all Host column values in the grant tables must be IP numbers or localhost. See Section 7.5.9, “How MySQL Uses DNS”.

  • --skip-networking

    Do not listen for TCP/IP connections at all. All interaction with mysqld must be made via named pipes or shared memory (on Windows) or Unix socket files (on Unix). This option is highly recommended for systems where only local clients are allowed. See Section 7.5.9, “How MySQL Uses DNS”.

  • --skip-new

    Do not use new, possibly wrong routines.

  • --skip-symlink

    This is the old form of --skip-symbolic-links, for use before MySQL 4.0.13.

  • --ssl*

    Options that begin with --ssl specify whether to allow clients to connect via SSL and indicate where to find SSL keys and certificates. See Section 5.6.7.3, “SSL Command Options”.

  • --standalone

    Available on Windows NT-based systems only; instructs the MySQL server not to run as a service.

  • --symbolic-links, --skip-symbolic-links

    Enable or disable symbolic link support. This option has different effects on Windows and Unix:

    This option was added in MySQL 4.0.13.

  • --skip-safemalloc

    If MySQL is configured with --with-debug=full, all MySQL programs check for memory overruns during each memory allocation and memory freeing operation. This checking is very slow, so for the server you can avoid it when you do not need it by using the --skip-safemalloc option.

  • --skip-show-database

    With this option, the SHOW DATABASES statement is allowed only to users who have the SHOW DATABASES privilege, and the statement displays all database names. Without this option, SHOW DATABASES is allowed to all users, but displays each database name only if the user has the SHOW DATABASES privilege or some privilege for the database. Note that any global privilege is considered a privilege for the database.

  • --skip-stack-trace

    do not write stack traces. This option is useful when you are running mysqld under a debugger. On some systems, you also must use this option to get a core file. See MySQL Internals: Porting.

  • --skip-thread-priority

    Disable using thread priorities for faster response time.

  • --socket=path

    On Unix, this option specifies the Unix socket file to use when listening for local connections. The default value is /tmp/mysql.sock. On Windows, the option specifies the pipe name to use when listening for local connections that use a named pipe. The default value is MySQL (not case sensitive).

  • --sql-mode=value[,value[,value...]]

    Set the SQL mode. See Section 5.1.7, “Server SQL Modes”. This option was added in 3.23.41.

  • --temp-pool

    This option causes most temporary files created by the server to use a small set of names, rather than a unique name for each new file. This works around a problem in the Linux kernel dealing with creating many new files with different names. With the old behavior, Linux seems to “leak” memory, because it is being allocated to the directory entry cache rather than to the disk cache.

  • --transaction-isolation=level

    Sets the default transaction isolation level. The level value can be READ-UNCOMMITTED, READ-COMMITTED, REPEATABLE-READ, or SERIALIZABLE. See Section 12.4.6, “SET TRANSACTION Syntax”.

  • --tmpdir=path, -t path

    The path of the directory to use for creating temporary files. It might be useful if your default /tmp directory resides on a partition that is too small to hold temporary tables. Starting from MySQL 4.1.0, this option accepts several paths that are used in round-robin fashion. Paths should be separated by colon characters (“:”) on Unix and semicolon characters (“;”) on Windows, NetWare, and OS/2. If the MySQL server is acting as a replication slave, you should not set --tmpdir to point to a directory on a memory-based file system or to a directory that is cleared when the server host restarts. For more information about the storage location of temporary files, see Section A.1.4.4, “Where MySQL Stores Temporary Files”. A replication slave needs some of its temporary files to survive a machine restart so that it can replicate temporary tables or LOAD DATA INFILE operations. If files in the temporary file directory are lost when the server restarts, replication fails.

  • --user={user_name|user_id}, -u {user_name|user_id}

    Run the mysqld server as the user having the name user_name or the numeric user ID user_id. (“User” in this context refers to a system login account, not a MySQL user listed in the grant tables.)

    This option is mandatory when starting mysqld as root. The server changes its user ID during its startup sequence, causing it to run as that particular user rather than as root. See Section 5.4.1, “General Security Guidelines”.

    Starting from MySQL 3.23.56 and 4.0.12: To avoid a possible security hole where a user adds a --user=root option to a my.cnf file (thus causing the server to run as root), mysqld uses only the first --user option specified and produces a warning if there are multiple --user options. Options in /etc/my.cnf and $MYSQL_HOME/my.cnf are processed before command-line options, so it is recommended that you put a --user option in /etc/my.cnf and specify a value other than root. The option in /etc/my.cnf is found before any other --user options, which ensures that the server runs as a user other than root, and that a warning results if any other --user option is found.

  • --verbose, -v

    As of MySQL 4.1.1, use this option with the --help option for detailed help.

  • --version, -V

    Display version information and exit.

As of MySQL 4.0, you can assign a value to a server system variable by using an option of the form --var_name=value. For example, --key_buffer_size=32M sets the key_buffer_size variable to a value of 32MB.

Note that when you assign a value to a variable, MySQL might automatically correct the value to stay within a given range, or adjust the value to the closest allowable value if only certain values are allowed.

If you want to restrict the maximum value to which a variable can be set at runtime with SET, you can define this by using the --maximum-var_name=value command-line option.

It is also possible to set variables by using --set-variable=var_name=value or --var_name=value syntax. This syntax is deprecated as of MySQL 4.0.

You can change the values of most system variables for a running server with the SET statement. See Section 12.5.4, “SET Syntax”.

Section 5.1.3, “Server System Variables”, provides a full description for all variables, and additional information for setting them at server startup and runtime. Section 7.5.3, “Tuning Server Parameters”, includes information on optimizing the server by tuning system variables.

5.1.3. Server System Variables

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. As of MySQL 4.0.3, most of them can be changed dynamically while the server is running by means of the SET statement, which enables you to modify operation of the server without having to stop and restart it. You can refer to 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 (omit --verbose before MySQL 4.1.1):

    mysqld --verbose --help
    
  • To see the values that a server will use based on its compiled-in defaults, ignoring the settings in any option files, use this command (omit --verbose before MySQL 4.1.1):

    mysqld --no-defaults --verbose --help
    
  • To see the current values used by a running server, use the SHOW VARIABLES statement.

This section provides a description of each system variable. Variables with no version indicated have been present since at least MySQL 3.22.

The following table lists all available system variables:

Variable NameVariable ScopeDynamic?
autocommitSESSIONyes
back_logGLOBALno
basedirGLOBALno
bdb_cache_sizeGLOBALno
bdb_homeGLOBALno
bdb_lock_detectGLOBALno
bdb_log_buffer_sizeGLOBALno
bdb_logdirGLOBALno
bdb_max_lockGLOBALno
bdb_shared_dataGLOBALno
bdb_tmpdirGLOBALno
big_tablesSESSIONyes
binlog_cache_sizeGLOBALyes
bulk_insert_buffer_sizeGLOBAL | SESSIONyes
character_set no
character_set_clientGLOBAL | SESSIONyes
character_set_connectionGLOBAL | SESSIONyes
character_set_databaseGLOBAL | SESSIONyes
character_set_resultsGLOBAL | SESSIONyes
character_set_serverGLOBAL | SESSIONyes
character_set_systemGLOBALno
character_sets_dirGLOBALno
collation_connectionGLOBAL | SESSIONyes
collation_databaseGLOBAL | SESSIONyes
collation_serverGLOBAL | SESSIONyes
concurrent_insertGLOBALyes
connect_timeoutGLOBALyes
datadirGLOBALno
date_formatGLOBAL | SESSIONyes
datetime_formatGLOBAL | SESSIONyes
debugGLOBAL | SESSIONyes
default-collation no
default_week_formatGLOBAL | SESSIONyes
delay_key_writeGLOBALyes
delayed_insert_limitGLOBALyes
delayed_insert_timeoutGLOBALyes
delayed_queue_sizeGLOBALyes
error_countSESSIONno
expire_logs_daysGLOBALyes
flushGLOBALyes
flush_timeGLOBALyes
foreign_key_checksSESSIONyes
ft_boolean_syntaxGLOBALyes
ft_max_word_lenGLOBALno
ft_min_word_lenGLOBALno
ft_query_expansion_limitGLOBALno
ft_stopword_fileGLOBALno
group_concat_max_lenGLOBAL | SESSIONyes
have_archiveGLOBALno
have_bdbGLOBALno
have_blackhole_engineGLOBALno
have_compressGLOBALno
have_cryptGLOBALno
have_csvGLOBALno
have_example_engineGLOBALno
have_geometryGLOBALno
have_innodbGLOBALno
have_isamGLOBALno
have_merge_engineGLOBALno
have_ndbclusterGLOBALno
have_opensslGLOBALno
have_query_cacheGLOBALno
have_raidGLOBALno
have_rtree_keysGLOBALno
have_symlinkGLOBALno
identitySESSIONyes
init_connectGLOBALyes
init_fileGLOBALno
init_slaveGLOBALyes
innodb_additional_mem_pool_sizeGLOBALno
innodb_autoextend_incrementGLOBALyes
innodb_buffer_pool_awe_mem_mbGLOBALno
innodb_buffer_pool_sizeGLOBALno
innodb_data_file_pathGLOBALno
innodb_data_home_dirGLOBALno
innodb_fast_shutdownGLOBALyes
innodb_file_io_threadsGLOBALno
innodb_file_per_tableGLOBALno
innodb_flush_log_at_trx_commitGLOBALyes
innodb_flush_methodGLOBALno
innodb_force_recoveryGLOBALno
innodb_lock_wait_timeoutGLOBALno
innodb_locks_unsafe_for_binlogGLOBALno
innodb_log_arch_dirGLOBALno
innodb_log_archiveGLOBALno
innodb_log_buffer_sizeGLOBALno
innodb_log_file_sizeGLOBALno
innodb_log_files_in_groupGLOBALno
innodb_log_group_home_dirGLOBALno
innodb_max_dirty_pages_pctGLOBALyes
innodb_max_purge_lagGLOBALyes
innodb_mirrored_log_groupsGLOBALno
innodb_open_filesGLOBALno
innodb_table_locksGLOBAL | SESSIONyes
innodb_thread_concurrencyGLOBALyes
insert_idSESSIONyes
interactive_timeoutGLOBAL | SESSIONyes
isam no
join_buffer_sizeGLOBAL | SESSIONyes
key_buffer_sizeGLOBALyes
key_cache_age_thresholdGLOBALyes
key_cache_block_sizeGLOBALyes
key_cache_division_limitGLOBALyes
languageGLOBALno
last_insert_idSESSIONyes
lc_time_namesGLOBAL | SESSIONyes
licenseGLOBALno
local_infileGLOBALyes
locked_in_memoryGLOBALno
logGLOBALno
log_binGLOBALno
log_binGLOBALno
log_errorGLOBALno
log_queries_not_using_indexesGLOBALyes
log_slave_updatesGLOBALno
log_slow_queriesGLOBALno
log_warningsGLOBAL | SESSIONyes
long_query_timeGLOBAL | SESSIONyes
low_priority_updatesGLOBAL | SESSIONyes
lower_case_file_systemGLOBALno
lower_case_table_namesGLOBALno
max_allowed_packetGLOBAL | SESSIONyes
max_binlog_cache_sizeGLOBALyes
max_binlog_sizeGLOBALyes
max_connect_errorsGLOBALyes
max_connectionsGLOBALyes
max_delayed_threadsGLOBAL | SESSIONyes
max_error_countGLOBAL | SESSIONyes
max_heap_table_sizeGLOBAL | SESSIONyes
max_insert_delayed_threadsGLOBAL | SESSIONyes
max_join_sizeGLOBAL | SESSIONyes
max_length_for_sort_dataGLOBAL | SESSIONyes
max_prepared_stmt_countGLOBALyes
max_relay_log_sizeGLOBALyes
max_seeks_for_keyGLOBAL | SESSIONyes
max_sort_lengthGLOBAL | SESSIONyes
max_tmp_tablesGLOBAL | SESSIONyes
max_user_connectionsGLOBALyes
max_write_lock_countGLOBALyes
locked_in_memoryGLOBALno
myisam_data_pointer_sizeGLOBALyes
myisam_max_extra_sort_file_sizeGLOBALno
myisam_max_sort_file_sizeGLOBALyes
myisam_recover_optionsGLOBALno
myisam_repair_threadsGLOBAL | SESSIONyes
myisam_sort_buffer_sizeGLOBAL | SESSIONyes
myisam_stats_methodGLOBAL | SESSIONyes
named_pipeGLOBALno
ndb_autoincrement_prefetch_szGLOBAL | SESSIONyes
ndb_cache_check_timeGLOBALyes
ndb_force_sendGLOBAL | SESSIONyes
ndb_use_exact_countGLOBAL | SESSIONyes
net_buffer_lengthGLOBAL | SESSIONyes
net_read_timeoutGLOBAL | SESSIONyes
net_retry_countGLOBAL | SESSIONyes
net_write_timeoutGLOBAL | SESSIONyes
newGLOBAL | SESSIONyes
old_passwordsGLOBAL | SESSIONyes
open_files_limitGLOBALno
pid_fileGLOBALno
plugin_dirGLOBALno
portGLOBALno
preload_buffer_sizeGLOBAL | SESSIONyes
prepared_stmt_countGLOBAL | SESSIONno
protocol_versionGLOBALno
pseudo_thread_idGLOBAL | SESSIONyes
query_alloc_block_sizeGLOBAL | SESSIONyes
query_cache_limitGLOBALyes
query_cache_min_res_unitGLOBALyes
query_cache_sizeGLOBALyes
query_cache_typeGLOBAL | SESSIONyes
query_cache_wlock_invalidateGLOBAL | SESSIONyes
query_prealloc_sizeGLOBAL | SESSIONyes
rand_seed1SESSIONyes
rand_seed2SESSIONyes
range_alloc_block_sizeGLOBAL | SESSIONyes
read_buffer_sizeGLOBAL | SESSIONyes
read_onlyGLOBALyes
read_rnd_buffer_sizeGLOBAL | SESSIONyes
relay_log_purgeGLOBALyes
relay_log_space_limitGLOBALno
report_hostGLOBALno
report_passwordGLOBALno
report_portGLOBALno
report_userGLOBALno
rpl_recovery_rankGLOBALyes
safe_show_databaseGLOBALyes
secure_authGLOBALyes
server_idGLOBALyes
shared_memoryGLOBALno
shared_memory_base_nameGLOBALno
skip_external_lockingGLOBALno
skip-isam no
skip_networkingGLOBALno
skip_show_databaseGLOBALno
skip-sync-bdb-logsGLOBALno
slave_compressed_protocolGLOBALyes
slave_load_tmpdirGLOBALno
slave_net_timeoutGLOBALyes
slave_skip_errorsGLOBALno
slave_transaction_retriesGLOBALyes
slow_launch_timeGLOBALyes
socketGLOBALno
sort_buffer_sizeGLOBAL | SESSIONyes
sql_auto_is_nullSESSIONyes
sql_big_selectsGLOBAL | SESSIONyes
sql_big_tablesSESSIONyes
sql_buffer_resultSESSIONyes
sql_log_binSESSIONyes
sql_log_offSESSIONyes
sql_log_updateSESSIONyes
sql_low_priority_updatesGLOBAL | SESSIONyes
sql_max_join_sizeGLOBAL | SESSIONyes
sql_modeGLOBAL | SESSIONyes
sql_notesSESSIONyes
sql_quote_show_createSESSIONyes
sql_safe_updatesSESSIONyes
sql_select_limitGLOBAL | SESSIONyes
sql_slave_skip_counterGLOBALyes
sql_warningsSESSIONyes
ssl_caGLOBALno
ssl_capathGLOBALno
ssl_certGLOBALno
ssl_cipherGLOBALno
ssl_keyGLOBALno
storage_engineGLOBAL | SESSIONyes
sync_bdb_logsGLOBALno
sync_binlogGLOBALyes
sync_frmGLOBALyes
system_time_zoneGLOBALno
table_typeGLOBAL | SESSIONyes
thread_cache_sizeGLOBALyes
thread_concurrencyGLOBALno
thread_stackGLOBALno
time_formatGLOBAL | SESSIONyes
time_zoneGLOBAL | SESSIONyes
timestampSESSIONyes
tmp_table_sizeGLOBAL | SESSIONyes
tmpdirGLOBALno
transaction_alloc_block_sizeGLOBAL | SESSIONyes
transaction_prealloc_sizeGLOBAL | SESSIONyes
tx_isolationGLOBAL | SESSIONyes
unique_checksSESSIONyes
versionGLOBALno
version_commentGLOBALno
version_compile_machineGLOBALno
version_compile_osGLOBALno
wait_timeoutGLOBAL | SESSIONyes
warning_countSESSIONno

For additional system variable information, see these sections:

Note

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. However, to set such a variable on the command line or in an option file, you must set it to 1 or 0; setting it to ON or OFF will not work. For example, on the command line, --delay_key_write=1 works but --delay_key_write=ON does not.

Values for buffer sizes, lengths, and stack sizes are given in bytes unless otherwise specified.

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.

  • ansi_mode

    This is ON if mysqld was started with --ansi. See Section 1.7.3, “Running MySQL in ANSI Mode”. This variable was added in MySQL 3.23.6 and removed in 3.23.41. See the description for sql_mode.

  • back_log

    The 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_log value 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_log cannot be set higher than your operating system limit.

  • basedir

    The MySQL installation base directory. This variable can be set with the --basedir option. Relative path names for other variables usually are resolved relative to the base directory.

  • bdb_cache_size

    The size of the buffer that is allocated for caching indexes and rows for BDB tables. If you do not use BDB tables, you should start mysqld with --skip-bdb to not allocate memory for this cache. This variable was added in MySQL 3.23.14.

  • bdb_home

    The base directory for BDB tables. This should be assigned the same value as the datadir variable. This variable was added in MySQL 3.23.14.

  • bdb_log_buffer_size

    The size of the buffer that is allocated for caching indexes and rows for BDB tables. If you do not use BDB tables, you should set this to 0 or start mysqld with --skip-bdb in order not to allocate memory for this cache. This variable was added in MySQL 3.23.31.

  • bdb_logdir

    The directory where the BDB storage engine writes its log files. This variable can be set with the --bdb-logdir option. This variable was added in MySQL 3.23.14.

  • bdb_max_lock

    The maximum number of locks that can be active for a BDB table (10,000 by default). You should increase this value if errors such as the following occur when you perform long transactions or when mysqld has to examine many rows to calculate a query:

    bdb: Lock table is out of available locks
    Got error 12 from ...
    

    This variable was added in MySQL 3.23.29.

  • bdb_shared_data

    This is ON if you are using --bdb-shared-data to start Berkeley DB in multi-process mode. (Do not use DB_PRIVATE when initializing Berkeley DB.) This variable was added in MySQL 3.23.29.

  • bdb_tmpdir

    The BDB temporary file directory. This variable was added in MySQL 3.23.14.

  • bdb_version

    See the description for version_bdb.

  • binlog_cache_size

    The size of the cache to hold the SQL statements for the binary log during a transaction. A binary log cache is allocated for each client if the server supports any transactional storage engines and, starting from MySQL 4.1.2, if the server has the binary log enabled (--log-bin option). If you often use large, multiple-statement transactions, you can increase this cache size to get more performance. The Binlog_cache_use and Binlog_cache_disk_use status variables can be useful for tuning the size of this variable. This variable was added in MySQL 3.23.29. See Section 5.3.4, “The Binary Log”.

    MySQL Enterprise For recommendations on the optimum setting for binlog_cache_size subscribe to the MySQL Enterprise Monitor. For more information, see http://www.mysql.com/products/enterprise/advisors.html.

  • bulk_insert_buffer_size

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

  • character_set

    The default character set. This variable was added in MySQL 3.23.3, then removed in MySQL 4.1.1 and replaced by the various character_set_xxx variables.

  • character_set_client

    The character set for statements that arrive from the client. This variable was added in MySQL 4.1.1.

    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-set option to enable this character set to be specified explicitly. See also Section 9.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 sjis when connecting to a server not configured with sjis support.

    • mysqld was started with the --skip-character-set-client-handshake option, 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.

  • character_set_connection

    The character set used for literals that do not have a character set introducer and for number-to-string conversion. This variable was added in MySQL 4.1.1.

  • character_set_database

    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. This variable was added in MySQL 4.1.1.

  • character_set_results

    The character set used for returning query results to the client. This variable was added in MySQL 4.1.1.

  • character_set_server

    The server default character set. This variable was added in MySQL 4.1.1.

  • character_set_system

    The character set used by the server for storing identifiers. The value is always utf8. This variable was added in MySQL 4.1.1.

  • character_sets

    The supported character sets. This variable was added in MySQL 3.23.15 and removed in MySQL 4.1.1. (Use SHOW CHARACTER SET for a list of character sets.)

  • character_sets_dir

    The directory where character sets are installed. This variable was added in MySQL 4.1.2.

  • collation_connection

    The collation of the connection character set. This variable was added in MySQL 4.1.1.

  • collation_database

    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. This variable was added in MySQL 4.1.1.

  • collation_server

    The server default collation. This variable was added in MySQL 4.1.1.

  • concurrent_insert

    If ON (the default), MySQL allows INSERT and SELECT statements to run concurrently for MyISAM tables that have no free blocks in the middle of the data file. You can turn this option off by starting mysqld with --safe-mode or --skip-new. This variable was added in MySQL 3.23.7.

    See also Section 7.3.3, “Concurrent Inserts”.

  • connect_timeout

    The number of seconds that the mysqld server waits for a connect packet before responding with Bad handshake. The default value is 5 seconds.

    Increasing the connect_timeout value might help if clients frequently encounter errors of the form Lost connection to MySQL server at 'XXX', system error: errno.

  • convert_character_set

    The current character set mapping that was set by SET CHARACTER SET. This variable was removed in MySQL 4.1.

  • datadir

    The MySQL data directory. This variable can be set with the --datadir option.

  • date_format

    This variable is unused.

  • datetime_format

    This variable is unused.

  • default_week_format

    The default mode value to use for the WEEK() function. See Section 11.6, “Date and Time Functions”. This variable is available as of MySQL 4.0.14.

  • delay_key_write

    This option applies only to MyISAM tables. It can have one of the following values to affect handling of the DELAY_KEY_WRITE table option that can be used in CREATE TABLE statements.

    OptionDescription
    OFFDELAY_KEY_WRITE is ignored.
    ONMySQL honors any DELAY_KEY_WRITE option specified in CREATE TABLE statements. This is the default value.
    ALLAll new opened tables are treated as if they were created with the DELAY_KEY_WRITE option enabled.

    If DELAY_KEY_WRITE is 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 all MyISAM tables by starting the server with the --myisam-recover option (for example, --myisam-recover=BACKUP,FORCE). See Section 5.1.2, “Server Command Options”, and Section 13.1.1, “MyISAM Startup Options”.

    Warning

    If you enable external locking with --external-locking, there is no protection against index corruption for tables that use delayed key writes.

    This variable was added in MySQL 3.23.8.

  • delayed_insert_limit

    After inserting delayed_insert_limit delayed rows, the INSERT DELAYED handler thread checks whether there are any SELECT statements pending. If so, it allows them to execute before continuing to insert delayed rows.

  • delayed_insert_timeout

    How many seconds an INSERT DELAYED handler thread should wait for INSERT statements before terminating.

  • delayed_queue_size

    This is a per-table limit on the number of rows to queue when handling INSERT DELAYED statements. If the queue becomes full, any client that issues an INSERT DELAYED statement waits until there is room in the queue again.

  • expire_logs_days

    The number of days for automatic binary log removal. The default is 0, which means “no automatic removal.” Possible removals happen at startup and at binary log rotation. This variable was added in MySQL 4.1.0.

  • flush

    If 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 A.1.4.2, “What to Do If MySQL Keeps Crashing”. This variable is set to ON if you start mysqld with the --flush option. This variable was added in MySQL 3.22.9.

  • flush_time

    If this is set to a nonzero value, all tables are closed every flush_time seconds to free up resources and synchronize unflushed data to disk. This option is best used only on Windows 9x or Me, or on systems with minimal resources. This variable was added in MySQL 3.22.18.

  • ft_boolean_syntax

    The list of operators supported by boolean full-text searches performed using IN BOOLEAN MODE. See Section 11.8.2, “Boolean Full-Text Searches”. This variable was added as a read-only variable in MySQL 4.0.1. It can be modified as of MySQL 4.1.2.

    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 allowed 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.

  • ft_max_word_len

    The maximum length of the word to be included in a FULLTEXT index. This variable was added in MySQL 4.0.0.

    Note

    FULLTEXT indexes must be rebuilt after changing this variable. Use REPAIR TABLE tbl_name QUICK.

  • ft_min_word_len

    The minimum length of the word to be included in a FULLTEXT index. This variable was added in MySQL 4.0.0.

    Note

    FULLTEXT indexes must be rebuilt after changing this variable. Use REPAIR TABLE tbl_name QUICK.

  • ft_query_expansion_limit

    The number of top matches to use for full-text searches performed using WITH QUERY EXPANSION. This variable was added in MySQL 4.1.1.

  • ft_stopword_file

    The file from which to read the list of stopwords for full-text searches. 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 the myisam/ft_static.c file). Setting this variable to the empty string ('') disables stopword filtering. This variable was added in MySQL 4.0.10.

    Note

    FULLTEXT indexes must be rebuilt after changing this variable or the contents of the stopword file. Use REPAIR TABLE tbl_name QUICK.

  • group_concat_max_len

    The maximum allowed result length in bytes for the GROUP_CONCAT() function. The default is 1024. This variable was added in MySQL 4.1.0.

  • have_archive

    YES if mysqld supports ARCHIVE tables, NO if not. This variable was added in MySQL 4.1.3.

  • have_bdb

    YES if mysqld supports BDB tables. DISABLED if --skip-bdb is used. This variable was added in MySQL 3.23.30.

  • have_blackhole_engine

    YES if mysqld supports BLACKHOLE tables, NO if not. This variable was added in MySQL 4.1.11.

  • have_compress

    YES if the zlib compression library is available to the server, NO if not. If not, the COMPRESS() and UNCOMPRESS() functions cannot be used. This variable was added in MySQL 4.1.1.

  • have_crypt

    YES if the crypt() system call is available to the server, NO if not. If not, the ENCRYPT() function cannot be used. This variable was added in MySQL 4.0.10.

  • have_csv

    YES if mysqld supports ARCHIVE tables, NO if not. This variable was added in MySQL 4.1.4.

  • have_example_engine

    YES if mysqld supports EXAMPLE tables, NO if not. This variable was added in MySQL 4.1.4.

  • have_geometry

    YES if the server supports spatial data types, NO if not. This variable was added in MySQL 4.1.3.

  • have_innodb

    YES if mysqld supports InnoDB tables. DISABLED if --skip-innodb is used. This variable was added in MySQL 3.23.37.

  • have_isam

    YES if mysqld supports ISAM tables. DISABLED if --skip-isam is used. This variable was added in MySQL 3.23.30.

  • have_merge_engine

    YES if mysqld supports MERGE tables. DISABLED if --skip-merge is used. This variable was added in MySQL 4.1.21.

  • have_openssl

    YES if mysqld supports SSL (encryption) connections, NO if not. This variable was added in MySQL 3.23.43.

  • have_query_cache

    YES if mysqld supports the query cache, NO if not. This variable was added in MySQL 4.0.2.

  • have_raid

    YES if mysqld supports the RAID option, NO if not. This variable was added in MySQL 3.23.30.

  • have_rtree_keys

    YES if RTREE indexes are available, NO if not. (These are used for spatial indexes in MyISAM tables.) This variable was added in MySQL 4.1.3.

  • have_symlink

    YES if symbolic link support is enabled, NO if not. This is required on Unix for support of the DATA DIRECTORY and INDEX DIRECTORY table options, and on Windows for support of data directory symlinks.

    This variable was added in MySQL 4.0.0.

  • init_connect

    A string to be executed by the server for each client that connects. The string consists of one or more SQL statements. To specify multiple statements, separate them by semicolon characters. For example, each client begins by default with autocommit mode enabled. There is no global system variable to specify that autocommit should be disabled by default, but init_connect can be used to achieve the same effect:

    SET GLOBAL init_connect='SET autocommit=0';
    

    This variable 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'
    

    Note that the content of init_connect is not executed for users that have the SUPER privilege. This is done so that an erroneous value for init_connect does 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 executing init_connect for users that have the SUPER privilege enables them to open a connection and fix the init_connect value.

    This variable was added in MySQL 4.1.2.

  • init_file

    The name of the file specified with the --init-file option 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. This variable was added in MySQL 3.23.2.

  • innodb_xxx

    InnoDB system variables are listed in Section 13.2.4, “InnoDB Startup Options and System Variables”.

  • interactive_timeout

    The 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_INTERACTIVE option to mysql_real_connect(). See also wait_timeout.

  • join_buffer_size

    The 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_size to 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.

  • key_buffer_size

    Index blocks for MyISAM and ISAM tables are buffered and are shared by all threads. key_buffer_size is the size of the buffer used for index blocks. The key buffer is also known as the key cache.

    The maximum allowable setting for key_buffer_size is 4GB. 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.

    Increase the value to get better index handling (for all reads and multiple writes) to as much as you can afford. Using a value that is 25% of total memory on a machine that mainly runs MySQL is quite common. However, if you make the value too large (for example, more than 50% of your total memory) your system might start to page and become extremely slow. 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. Consider also the memory requirements of other storage engines.

    For even more speed when writing many rows at the same time, use LOCK TABLES. See Section 7.2.14, “Speed of INSERT Statements”.

    You can check the performance of the key buffer by issuing a SHOW STATUS statement and examining the Key_read_requests, Key_reads, Key_write_requests, and Key_writes status variables. (See Section 12.5.5, “SHOW Syntax”.) The Key_reads/Key_read_requests ratio should normally be less than 0.01. The Key_writes/Key_write_requests ratio 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 the DELAY_KEY_WRITE table option.

    The fraction of the key buffer in use can be determined using key_buffer_size in conjunction with the Key_blocks_unused status variable and the buffer block size. From MySQL 4.1.1 on, the buffer block size is available from the key_cache_block_size server variable. The fraction of the buffer in use is:

    1 - ((Key_blocks_unused × key_cache_block_size) / key_buffer_size)
    

    This value is an approximation because some space in the key buffer may be allocated internally for administrative structures.

    Before MySQL 4.1.1, key cache blocks are 1024 bytes, and before MySQL 4.1.2, Key_blocks_unused is unavailable. The Key_blocks_used variable can be used as follows to determine the fraction of the key buffer in use:

    (Key_blocks_used × 1024) / key_buffer_size
    

    However, Key_blocks_used indicates the maximum number of blocks that have ever been in use at once, so this formula does not necessarily represent the current fraction of the buffer that is in use.

    As of MySQL 4.1, it is possible to create multiple MyISAM key caches. The size limit of 4GB applies to each cache individually, not as a group. See Section 7.4.5, “The MyISAM Key Cache”.

  • key_cache_age_threshold

    This value controls the demotion of buffers from the hot sub-chain of a key cache to the warm sub-chain. Lower values cause demotion to happen more quickly. The minimum value is 100. The default value is 300. This variable was added in MySQL 4.1.1. See Section 7.4.5, “The MyISAM Key Cache”.

  • key_cache_block_size

    The size in bytes of blocks in the key cache. The default value is 1024. This variable was added in MySQL 4.1.1. See Section 7.4.5, “The MyISAM Key Cache”.

  • key_cache_division_limit

    The division point between the hot and warm sub-chains of the key cache buffer chain. The value is the percentage of the buffer chain to use for the warm sub-chain. Allowable values range from 1 to 100. The default value is 100. This variable was added in MySQL 4.1.1. See Section 7.4.5, “The MyISAM Key Cache”.

  • language

    The language used for error messages.

  • large_files_support

    Whether mysqld was compiled with options for large file support. This variable was added in MySQL 3.23.28.

  • lc_time_names

    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() and MONTHNAME() 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 9.8, “MySQL Server Locale Support”. This variable was added in MySQL 4.1.21.

  • license

    The type of license the server has. This variable was added in MySQL 4.0.19.

  • local_infile

    Whether LOCAL is supported for LOAD DATA INFILE statements. See Section 5.4.4, “Security Issues with LOAD DATA LOCAL. This variable was added in MySQL 4.0.3.

  • locked_in_memory

    Whether mysqld was locked in memory with --memlock. This variable was added in MySQL 3.23.25.

  • log

    Whether logging of all statements to the general query log is enabled. See Section 5.3.2, “The General Query Log”.

  • log_error

    The location of the error log. This variable was added in MySQL 4.0.10.

  • log_slow_queries

    Whether slow queries should be logged. “Slow” is determined by the value of the long_query_time variable. This variable was added in MySQL 4.0.2. See Section 5.3.5, “The Slow Query Log”.

  • log_update

    Whether the update log is enabled. This variable was added in MySQL 3.22.18. Note that the binary log is preferable to the update log, which is unavailable as of MySQL 5.0. See Section 5.3.3, “The Update Log”.

  • log_warnings

    Whether to produce additional warning messages. This variable was added in MySQL 4.0.3. It is enabled by default as of MySQL 4.0.19 and 4.1.2. As of MySQL 4.0.21 and 4.1.3, the variable can take values greater than 1 and aborted connections are not logged to the error log unless the value is greater than 1.

  • long_query_time

    If a query takes longer than this many seconds, the server increments the Slow_queries status variable. If you are using the --log-slow-queries option, 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 value is 1. The default is 10. See Section 5.3.5, “The Slow Query Log”.

  • low_priority_updates

    If set to 1, all INSERT, UPDATE, DELETE, and LOCK TABLE WRITE statements wait until there is no pending SELECT or LOCK TABLE READ on the affected table. This affects only storage engines that use only table-level locking (MyISAM, MEMORY, MERGE). Before MySQL 3.22.5, this variable was named sql_low_priority_updates.

  • lower_case_file_system

    This variable describes the case sensitivity of file names on the file system where the data directory is located. OFF means file names are case sensitive, ON means they are not case sensitive. This variable was added in MySQL 4.0.19.

  • lower_case_table_names

    If set to 1 table names are stored in lowercase on disk and table name comparisons are not case sensitive. This variable was added in MySQL 3.23.6. If set to 2 (new in 4.0.18), table names are stored as given but compared in lowercase. From MySQL 4.0.2, this option also applies to database names. From 4.1.1, it also applies to table aliases. See Section 8.2.2, “Identifier Case Sensitivity”.

    Note

    If you are using InnoDB tables, you should set this variable to 1 on all platforms to force names to be converted to lowercase.

    You should not set this variable to 0 if you are running MySQL on a system that does not have case-sensitive file names (such as Windows or Mac OS X). New in 4.0.18: If this variable is not set at startup and the file system on which the data directory is located does not have case-sensitive file names, MySQL automatically sets lower_case_table_names to 2.

  • max_allowed_packet

    The maximum size of one packet or any generated/intermediate string.

    The packet message buffer is initialized to net_buffer_length bytes, but can grow up to max_allowed_packet bytes when needed. This value by default is small, to catch large (possibly incorrect) packets.

    You must increase this value if you are using large BLOB columns or long strings. It should be as big as the largest BLOB you want to use. The protocol limit for max_allowed_packet is 16MB before MySQL 4.0 and 1GB thereafter. 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_packet variable, you should also change the buffer size on the client side if your client program allows it. On the client side, max_allowed_packet has a default of 1GB. Some programs such as mysql and mysqldump enable you to change the client-side value by setting max_allowed_packet on the command line or in an option file.

  • max_connect_errors

    If there are more than this number of interrupted connections from a host, that host is blocked from further connections. You can unblock blocked hosts with the FLUSH HOSTS statement.

  • max_connections

    The number of simultaneous client connections allowed. By default, this is 100. See Section A.1.2.7, “Too many connections, for more information.

    MySQL Enterprise For notification that the maximum number of connections is getting dangerously high and for advice on setting the optimum value for max_connections subscribe to the MySQL Enterprise Monitor. For more information, see http://www.mysql.com/products/enterprise/advisors.html.

    Increasing this value increases the number of file descriptors that mysqld requires. See Section 7.4.7, “How MySQL Opens and Closes Tables”, for comments on file descriptor limits.

  • max_delayed_threads

    Do not start more than this number of threads to handle INSERT DELAYED statements. If you try to insert data into a new table after all INSERT DELAYED threads are in use, the row is inserted as if the DELAYED attribute wasn't specified. If you set this to 0, MySQL never creates a thread to handle DELAYED rows; in effect, doing so disables DELAYED entirely. This variable was added in MySQL 3.23.0.

    For the SESSION value of this variable, the only valid values are 0 or the GLOBAL value.

  • max_error_count

    The maximum number of error, warning, and note messages to be stored for display by the SHOW ERRORS or SHOW WARNINGS statements. This variable was added in MySQL 4.1.0.

  • max_heap_table_size

    This variable sets the maximum size to which MEMORY (HEAP) tables are allowed to grow. The value of the variable is used to calculate MEMORY table MAX_ROWS values. Setting this variable has no effect on any existing MEMORY table, unless the table is re-created with a statement such as CREATE TABLE, or altered with ALTER TABLE or TRUNCATE TABLE. A server restart also sets the maximum size of existing MEMORY tables to the global max_heap_table_size value. This variable was added in MySQL 3.23.0.

    Note

    On 64-bit platforms, the maximum value for this variable is 1844674407370954752.

    MySQL Enterprise Subscribers to the MySQL Enterprise Monitor receive recommendations for the optimum setting for max_heap_table_size. For more information, see http://www.mysql.com/products/enterprise/advisors.html.

  • max_insert_delayed_threads

    This variable is a synonym for max_delayed_threads. It was added in MySQL 4.0.19.

  • max_join_size

    Do not allow SELECT statements that probably need to examine more than max_join_size rows (for single-table statements) or row combinations (for multiple-table statements) or that are likely to do more than max_join_size disk seeks. By setting this value, you can catch SELECT 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 a WHERE clause, that take a long time, or that return millions of rows.

    Setting this variable to a value other than DEFAULT resets the value of sql_big_selects to 0. If you set the sql_big_selects value again, the max_join_size variable 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.

    This variable previously was named sql_max_join_size.

  • max_length_for_sort_data

    The cutoff on the size of index values that determines which filesort algorithm to use. See Section 7.2.9, “ORDER BY Optimization”. This variable was added in MySQL 4.1.1

  • max_prepared_stmt_count

    This 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 allowable range of values is from 0 to 1 million. Setting the value to 0 disables prepared statements. This variable was added in MySQL 4.1.19.

  • max_relay_log_size

    If 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_size is 0, the server uses max_binlog_size for both the binary log and the relay log. If max_relay_log_size is greater than 0, it constrains the size of the relay log, which enables you to have different sizes for the two logs. You must set max_relay_log_size to between 4096 bytes and 1GB (inclusive), or to 0. The default value is 0. This variable was added in MySQL 4.0.14. See Section 14.3, “Replication Implementation Details”.

  • max_seeks_for_key

    Limit 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 12.5.5.13, “SHOW INDEX Syntax”). By setting this to a low value (say, 100), you can force MySQL to prefer indexes instead of table scans.

    This variable was added in MySQL 4.0.14.

  • max_sort_length

    The number of bytes to use when sorting BLOB or TEXT values. Only the first max_sort_length bytes of each value are used; the rest are ignored.

  • max_tmp_tables

    The maximum number of temporary tables a client can keep open at the same time. (This option does not yet do anything.)

  • max_user_connections

    The maximum number of simultaneous connections allowed to any given MySQL account. A value of 0 means “no limit.” This variable was added in MySQL 3.23.34.

    This variable has only a global form.

  • max_write_lock_count

    After this many write locks, allow some pending read lock requests to be processed in between. This variable was added in MySQL 3.23.7.

  • myisam_data_pointer_size

    The default pointer size in bytes, to be used by CREATE TABLE for MyISAM tables when no MAX_ROWS option is specified. This variable cannot be less than 2 or larger than 7. The default value is 4. This variable was added in MySQL 4.1.2. See Section A.1.2.12, “The table is full.

  • myisam_max_extra_sort_file_size

    If the temporary file used for fast MyISAM index creation would be larger than using the key cache by the amount specified here, prefer the key cache method. This is mainly used to force long character keys in large tables to use the slower key cache method to create the index. This variable was added in MySQL 3.23.37.

    Note

    The value is given in megabytes before 4.0.3 and in bytes thereafter.

  • myisam_max_sort_file_size

    The maximum size of the temporary file that MySQL is allowed to use while re-creating a MyISAM index (during REPAIR TABLE, ALTER TABLE, or LOAD DATA INFILE). If the file size would be larger than this value, the index is created using the key cache instead, which is slower. This variable was added in MySQL 3.23.37.

    Note

    The value is given in megabytes before 4.0.3 and in bytes thereafter.

    The default value is 2GB. If MyISAM index files exceed this size and disk space is available, increasing the value may help performance.

  • myisam_recover_options

    The value of the --myisam-recover option. See Section 5.1.2, “Server Command Options”. This variable was added in MySQL 3.23.36.

  • myisam_repair_threads

    If this value is greater than 1, MyISAM table indexes are created in parallel (each index in its own thread) during the Repair by sorting process. The default value is 1.

    Note

    Multi-threaded repair is still beta-quality code. This variable was added in MySQL 4.0.13.

  • myisam_sort_buffer_size

    The size of the buffer that is allocated when sorting MyISAM indexes during a REPAIR TABLE or when creating indexes with CREATE INDEX or ALTER TABLE. This variable was added in MySQL 3.23.16.

  • myisam_stats_method

    How the server treats NULL values when collecting statistics about the distribution of index values for MyISAM tables. This variable has three possible values, nulls_equal, nulls_unequal, and nulls_ignored. For nulls_equal, all NULL index values are considered equal and form a single value group that has a size equal to the number of NULL values. For nulls_unequal, NULL values are considered unequal, and each NULL forms a distinct value group of size 1. For nulls_ignored, NULL values are ignored.

    The method that is used for generating table statistics influences how the optimizer chooses indexes for query execution, as described in Section 7.4.6, “MyISAM Index Statistics Collection”.

    Any unique prefix of a valid value may be used to set the value of this variable.

    This variable was added in MySQL 4.1.15. For older versions, the statistics collection method is equivalent to nulls_equal.

  • named_pipe

    On Windows, indicates whether the server supports connections over named pipes. This variable was added in MySQL 3.23.50.

  • net_buffer_length

    Each client thread is associated with a connection buffer and result buffer. Both begin with a size given by net_buffer_length but are dynamically enlarged up to max_allowed_packet bytes as needed. The result buffer shrinks to net_buffer_length after 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_length can be set is 1MB.

  • net_read_timeout

    The number of seconds to wait for more data from a connection before aborting the read. This timeout applies only to TCP/IP connections, not to connections made via Unix socket files, named pipes, or shared memory. When the server is reading from the client, net_read_timeout is the timeout value controlling when to abort. When the server is writing to the client, net_write_timeout is the timeout value controlling when to abort. See also slave_net_timeout. This variable was added in MySQL 3.23.20.

  • net_retry_count

    If a read 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. This variable was added in MySQL 3.23.7.

  • net_write_timeout

    The number of seconds to wait for a block to be written to a connection before aborting the write. This timeout applies only to TCP/IP connections, not to connections made via Unix socket files, named pipes, or shared memory. See also net_read_timeout. This variable was added in MySQL 3.23.20.

  • new

    This variable is used in MySQL 4.0 to turn on some 4.1 behaviors. This variable was added in MySQL 4.0.12.

  • old_passwords

    Whether the server should use pre-4.1-style passwords for MySQL user accounts. This variable was added in MySQL 4.1.1.

  • one_shot

    This is not a variable, but it can be used when setting some variables. It is described in Section 12.5.4, “SET Syntax”.

  • open_files_limit

    The number of files that the operating system allows mysqld to open. This is the real value allowed by the system and might be different from the value you gave using the --open-files-limit option to mysqld or mysqld_safe. The value is 0 on systems where MySQL can't change the number of open files. This variable was added in MySQL 3.23.20.

  • pid_file

    The path name of the process ID (PID) file. This variable can be set with the --pid-file option. This variable was added in MySQL 3.23.23.

  • plugin_dir

    The path name of the plugin directory. This variable was added in MySQL 4.1.25. If the value is nonempty, user-defined function object files must be located in this directory. If the value is empty, the behavior that is used before 4.1.25 applies: The UDF object files must be located in a directory that is searched by your system's dynamic linker.

  • port

    The number of the port on which the server listens for TCP/IP connections. This variable can be set with the --port option.

  • preload_buffer_size

    The size of the buffer that is allocated when preloading indexes. This variable was added in MySQL 4.1.1.

  • prepared_stmt_count

    The current number of prepared statements. (The maximum number of statements is given by the max_prepared_stmt_count system variable.) This variable was added in MySQL 4.1.19. In MySQL 4.1.23, it was converted to the global Prepared_stmt_count status variable.

  • protocol_version

    The version of the client/server protocol used by the MySQL server. This variable was added in MySQL 3.23.18.

  • pseudo_thread_id

    Variable Namepseudo_thread_id
    Variable ScopeBoth
    Dynamic VariableYes
    Value Set
    Typenumeric

    This variable is for internal server use.

  • query_alloc_block_size

    The 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 a bit. This variable was added in MySQL 4.0.16.

  • query_cache_limit

    Don't cache results that are larger than this number of bytes. The default value is 1MB. This variable was added in MySQL 4.0.1.

  • query_cache_min_res_unit

    The minimum size for blocks allocated by the query cache. The default value is 4KB. Tuning information for this variable is given in Section 7.5.4.3, “Query Cache Configuration”. This variable is present from MySQL 4.1.

  • query_cache_size

    The amount of memory allocated for caching query results. The default value is 0, which disables the query cache. The allowable values are multiples of 1024; other values are rounded down to the nearest multiple. Note that query_cache_size bytes of memory are allocated even if query_cache_type is set to 0. This variable was added in MySQL 4.0.1.

    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_size too small, you'll get a warning, as described in Section 7.5.4.3, “Query Cache Configuration”.

  • query_cache_type

    Set the query cache type. Setting the GLOBAL value sets the type for all clients that connect thereafter. Individual clients can set the SESSION value to affect their own use of the query cache.

    OptionDescription
    0 or OFFDon't 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_size to 0.
    1 or ONCache all cacheable query results except for those that begin with SELECT SQL_NO_CACHE.
    2 or DEMANDCache results only for cacheable queries that begin with SELECT SQL_CACHE.

    This variable defaults to ON.

    Any unique prefix of a valid value may be used to set the value of this variable.

    This variable was added in MySQL 4.0.3.

  • query_cache_wlock_invalidate

    Normally, when one client acquires a WRITE lock on a MyISAM table, 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 a WRITE lock 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. This variable was added in MySQL 4.0.19.

  • query_prealloc_size

    The 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_size value might be helpful in improving performance, because it can reduce the need for the server to perform memory allocation during query execution operations.

    This variable was added in MySQL 4.0.16.

  • range_alloc_block_size

    The size of blocks that are allocated when doing range optimization. This variable was added in MySQL 4.0.16.

  • read_buffer_size

    Each thread that does a sequential scan 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.

    read_buffer_size and read_rnd_buffer_size are not specific to any storage engine and apply in a general manner for optimization. See Section 7.5.7, “How MySQL Uses Memory”, for example.

    Before MySQL 4.0.3, this variable was named record_buffer.

  • read_only

    This variable is off by default. When it is enabled, the server allows no updates except from users that have the SUPER privilege or (on a slave server) from updates performed by slave threads. On a slave server, this can be useful to ensure that the slave accepts updates only from its master server and not from clients.

    read_only exists only as a GLOBAL variable, so changes to its value require the SUPER privilege. Changes to read_only on 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.

    This variable was added in MySQL 4.0.14.

  • read_rnd_buffer_size

    When reading rows in sorted order following a key-sorting operation, the rows are read through this buffer to avoid disk seeks. See Section 7.2.9, “ORDER BY Optimization”. Setting the variable to a large value can improve ORDER BY performance 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.

    read_buffer_size and read_rnd_buffer_size are not specific to any storage engine and apply in a general manner for optimization. See Section 7.5.7, “How MySQL Uses Memory”, for example.

    Before MySQL 4.0.3, this variable was named record_rnd_buffer.

  • relay_log_purge

    Disables or enables automatic purging of relay log files as soon as they are not needed any more. The default value is 1 (ON).

  • relay_log_space_limit

    The maximum amount of space to use for all relay logs.

  • safe_show_database

    Do not show databases for which the user has no database or table privileges. This can improve security if you are concerned about people being able to see what databases other users have. See also skip_show_database.

    This variable was removed in MySQL 4.0.5. Beginning with this version, you should instead use the SHOW DATABASES privilege to control access by MySQL accounts to databases.

  • secure_auth

    If the MySQL server has been started with the --secure-auth option, it blocks connections from all accounts that have passwords stored in the old (pre-4.1) format. In that case, the value of this variable is ON, otherwise it is OFF.

    You should enable this option if you want to prevent all use of passwords in the old format (and hence insecure communication over the network). This variable was added in MySQL 4.1.1.

    Server startup fails with an error if this option is enabled and the privilege tables are in pre-4.1 format.

  • server_id

    The server ID, used in replication to give each master and slave a unique identity. This variable is set by the --server-id option. 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.

  • shared_memory

    (Windows only.) Whether the server allows shared-memory connections. This variable was added in MySQL 4.1.1.

  • shared_memory_base_name

    (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. This variable was added in MySQL 4.1.0.

  • skip_external_locking

    This is OFF if mysqld uses external locking, ON if external locking is disabled. Before MySQL 4.0.3, this variable was named skip_locking.

  • skip_networking

    This is ON if the server allows 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. On NetWare, only TCP/IP connections are supported, so do not set this variable to ON. This variable can be set to ON with the --skip-networking option. This variable was added in MySQL 3.22.23.

  • skip_show_database

    This prevents people from using the SHOW DATABASES statement if they do not have the SHOW DATABASES privilege. This can improve security if you are concerned about people being able to see what databases other users have. See also safe_show_database. This variable was added in MySQL 3.23.4. As of MySQL 4.0.2, its effect also depends on the SHOW DATABASES privilege: If the variable value is ON, the SHOW DATABASES statement is allowed only to users who have the SHOW DATABASES privilege, and the statement displays all database names. If the value is OFF, SHOW DATABASES is allowed to all users, but displays each database name only if the user has the SHOW DATABASES privilege or some privilege for the database. Note that any global privilege is a privilege for the database.

  • slow_launch_time

    If creating a thread takes longer than this many seconds, the server increments the Slow_launch_threads status variable. This variable was added in MySQL 3.23.15.

  • socket

    On 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/mysql for 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).

  • sort_buffer_size

    Each thread that needs to do a sort allocates a buffer of this size. Increase this value for faster ORDER BY or GROUP BY operations. See Section A.1.4.4, “Where MySQL Stores Temporary Files”.

  • sql_mode

    The current server SQL mode. This variable was added in MySQL 3.23.41. It can be set dynamically as of MySQL 4.1.1. See Section 5.1.7, “Server SQL Modes”.

  • sql_select_limit

    The maximum number of rows to return from SELECT statements. The default value for a new connection is the maximum number of rows that the server allows per table, which depends on the server configuration and may be affected if the server build was configured with --with-big-tables. 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 of DEFAULT.

    If a SELECT has a LIMIT clause, the LIMIT takes precedence over the value of sql_select_limit.

    sql_select_limit does not apply to SELECT statements executed within stored routines. It also does not apply to SELECT statements that do not produce a result set to be returned to the client. These include SELECT statements in subqueries, CREATE TABLE ... SELECT, and INSERT INTO ... SELECT.

  • storage_engine

    This variable is a synonym for table_type. It was added in MySQL 4.1.2.

  • sync_frm

    If this variable is set to 1, when any nontemporary table is created its .frm file is synchronized to disk (using fdatasync()). This is slower but safer in case of a crash. The default is 1. This was added as a command-line option in MySQL 4.0.18. It is also a settable global variable as of MySQL 4.1.3.

  • system_time_zone

    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 the TZ environment variable. It also can be specified using the --timezone option of the mysqld_safe script.

    The system_time_zone variable differs from time_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 9.7, “MySQL Server Time Zone Support”.

    system_time_zone was added in MySQL 4.1.3.

  • table_cache

    The 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_tables status variable. See Section 5.1.6, “Server Status Variables”. If the value of Opened_tables is large and you do not do FLUSH TABLES often (which just forces all tables to be closed and reopened), then you should increase the value of the table_cache variable. For more information about the table cache, see Section 7.4.7, “How MySQL Opens and Closes Tables”.

  • table_type

    The default table type (storage engine). To set the table type at server startup, use the --default-table-type option. This variable was added in MySQL 3.23.0. See Section 5.1.2, “Server Command Options”.

  • thread_cache_size

    How many threads the server should cache for reuse. When a client disconnects, the client's threads are put in the cache if there are fewer than thread_cache_size threads there. Requests for threads are satisfied by reusing threads taken from the cache if possible, and only when the cache is empty is a new thread created. This variable can be increased to improve performance if you have a lot of new connections. (Normally, this doesn't provide a notable performance improvement if you have a good thread implementation.) By examining the difference between the Connections and Threads_created status variables, you can see how efficient the thread cache is. For details, see Section 5.1.6, “Server Status Variables”. This variable was added in MySQL 3.23.16.

  • thread_concurrency

    This variable is specific to Solaris systems, for which mysqld invokes the thr_setconcurrency() with the variable value. This function enables applications to give the threads system a hint about the desired number of threads that should be run at the same time. This variable was added in MySQL 3.23.7.

  • thread_stack

    The stack size for each thread. Many of the limits detected by the crash-me test are dependent on this value. The default is large enough for normal operation. See Section 7.1.4, “The MySQL Benchmark Suite”. The default is 64KB before MySQL 4.0.10 and 192KB thereafter. 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.

  • time_format

    This variable is unused.

  • time_zone

    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 of system_time_zone”). The value can be specified explicitly at server startup with the --default-time-zone option. See Section 9.7, “MySQL Server Time Zone Support”. This variable was added in MySQL 4.1.3.

  • timezone

    The time zone for the server. This is set from the TZ environment variable when mysqld is started. The time zone also can be set by giving a --timezone argument to mysqld_safe. This variable was added in MySQL 3.23.15. As of MySQL 4.1.3, it is obsolete and has been replaced by the system_time_zone variable. See Section A.1.4.6, “Time Zone Problems”.

  • tmp_table_size

    The maximum size of internal in-memory temporary tables. (The actual limit is determined as the smaller of max_heap_table_size and tmp_table_size.) If an in-memory temporary table exceeds the limit, MySQL automatically converts it to an on-disk MyISAM table. Increase the value of tmp_table_size (and max_heap_table_size if necessary) if you do many advanced GROUP BY queries and you have lots of memory. This variable does not apply to user-created MEMORY tables.

  • tmpdir

    The directory used for temporary files and temporary tables. Starting from MySQL 4.1, 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, NetWare, and OS/2.

    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 tmpdir to 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 or LOAD DATA INFILE operations. If files in the temporary file directory are lost when the server restarts, replication fails. However, if you are using MySQL 4.0.0 or later, you can set the slave's temporary directory using the slave_load_tmpdir variable. In that case, the slave won't use the general tmpdir value and you can set tmpdir to a nonpermanent location.

    This variable was added in MySQL 3.22.4.

  • transaction_alloc_block_size

    The amount in bytes by which to increase a per-transaction memory pool which needs memory. See the description of transaction_prealloc_size. This variable was added in MySQL 4.0.16.

  • transaction_prealloc_size

    There 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 by transaction_alloc_block_size bytes. When the transaction ends, the pool is truncated to transaction_prealloc_size bytes.

    By making transaction_prealloc_size sufficiently large to contain all statements within a single transaction, you can avoid many malloc() calls. This variable was added in MySQL 4.0.16.

  • tx_isolation

    The default transaction isolation level. This variable was added in MySQL 4.0.3.

    This variable is set by the SET TRANSACTION ISOLATION LEVEL statement. See Section 12.4.6, “SET TRANSACTION Syntax”. If you set tx_isolation directly to an isolation level name that contains a space, the name should be enclosed within quotes, 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.

  • version

    The version number for the server.

  • version_bdb

    The BDB storage engine version. This variable was added in MySQL 3.23.31 with the name bdb_version and renamed to version_bdb in MySQL 4.1.1.

  • version_comment

    The configure script has a --with-comment option that allows a comment to be specified when building MySQL. This variable contains the value of that comment. This variable was added in MySQL 4.0.17.

  • version_compile_machine

    The type of machine or architecture on which MySQL was built. This variable was added in MySQL 4.1.1.

  • version_compile_os

    The type of operating system on which MySQL was built. This variable was added in MySQL 4.0.19.

  • wait_timeout

    The number of seconds the server waits for activity on a noninteractive connection before closing it. This timeout applies only to TCP/IP and Unix socket file connections, not to connections made via named pipes, or shared memory.

    On thread startup, the session wait_timeout value is initialized from the global wait_timeout value or from the global interactive_timeout value, depending on the type of client (as defined by the CLIENT_INTERACTIVE connect option to mysql_real_connect()). See also interactive_timeout.

MySQL Enterprise Expert use of server system variables is part of the service offered by the MySQL Enterprise Monitor. To subscribe, see http://www.mysql.com/products/enterprise/advisors.html.

5.1.4. Session System Variables

Several system variables exist only as session variables. These cannot be set at server startup but can be assigned values at runtime using the SET statement (except for those that are read only). Most of them are not displayed by SHOW VARIABLES, but you can obtain their values using SELECT. This section describes the session system variables. For information about setting or displaying their values, see Section 5.1.5, “Using System Variables”. For example:

mysql> SELECT @@autocommit;
+--------------+
| @@autocommit |
+--------------+
|            1 |
+--------------+

The lettercase of these variables does not matter.

The following table lists the system variables that have only session scope:

Table 5.2. mysqld Session System Variable Summary

NameCmd-LineOption fileSystem VarDynamic
autocommit  YesYes
big-tablesYesYes  
- Variable: big_tables  YesYes
error_count  YesNo
foreign_key_checks  YesYes
identity  YesYes
insert_id  YesYes
last_insert_id  YesYes
rand_seed1  YesYes
rand_seed2  YesYes
sql_auto_is_null  YesYes
sql_big_tables  YesYes
sql_buffer_result  YesYes
sql_log_bin  YesYes
sql_log_off  YesYes
sql_log_update  YesYes
sql_notes  YesYes
sql_quote_show_create  YesYes
sql_safe_updates  YesYes
sql_warnings  YesYes
timestamp  YesYes
unique_checks  YesYes
warning_count  YesNo
  • autocommit

    The autocommit mode. If set to 1, all changes to a table take effect immediately. If set to 0, you must use COMMIT to accept a transaction or ROLLBACK to cancel it. By default, client connections begin with autocommit set to 1. If you change autocommit mode from 0 to 1, MySQL performs an automatic COMMIT of any open transaction. Another way to begin a transaction is to use a START TRANSACTION or BEGIN statement. See Section 12.4.1, “START TRANSACTION, COMMIT, and ROLLBACK Syntax”.

  • big_tables

    If set to 1, all temporary tables are stored on disk rather than in memory. This is a little slower, but the error The table tbl_name is full does not occur for SELECT operations that require a large temporary table. The default value for a new connection is 0 (use in-memory temporary tables). As of MySQL 4.0, you should normally never need to set this variable, because MySQL automatically converts in-memory tables to disk-based tables as necessary.

    Note

    This variable was formerly named sql_big_tables.

  • error_count

    The number of errors that resulted from the last statement that generated messages. This variable is read only. See Section 12.5.5.11, “SHOW ERRORS Syntax”.

    This variable was added in MySQL 4.1.0.

  • foreign_key_checks

    If set to 1 (the default), foreign key constraints for InnoDB tables are checked. If set to 0, they are ignored. Disabling foreign key checking can be useful for reloading InnoDB tables in an order different from that required by their parent/child relationships. This variable was added in MySQL 3.23.52. See Section 13.2.5.4, “FOREIGN KEY Constraints”.

    Setting foreign_key_checks to 0 also affects data definition statements: DROP DATABASE drops a database even if it contains tables that have foreign keys that are referred to by tables outside the database, and DROP TABLE drops tables that have foreign keys that are referred to by other tables.

    Note

    Setting foreign_key_checks to 1 does not trigger a scan of the existing table data. Therefore, rows added to the table while foreign_key_checks = 0 will not be verified for consistency.

  • identity

    This variable is a synonym for the last_insert_id variable. It exists for compatibility with other database systems. As of MySQL 3.23.25, you can read its value with SELECT @@identity. As of MySQL 4.0.3, you can also set its value with SET identity.

  • insert_id

    The value to be used by the following INSERT or ALTER TABLE statement when inserting an AUTO_INCREMENT value. This is mainly used with the binary log.

  • last_insert_id

    The value to be returned from LAST_INSERT_ID(). This is