Chapter 5. MySQL Server Administration

Table of Contents

5.1. The MySQL Server
5.1.1. Option and Variable Reference
5.1.2. Command Options
5.1.3. System Variables
5.1.4. Session System Variables
5.1.5. Using System Variables
5.1.6. Status Variables
5.1.7. SQL Modes
5.1.8. Server-Side Help
5.1.9. Server Response to Signals
5.1.10. The Shutdown Process
5.2. MySQL Server Logs
5.2.1. The Error Log
5.2.2. The General Query Log
5.2.3. The Binary Log
5.2.4. The Slow Query Log
5.2.5. Server Log Maintenance
5.3. General Security Issues
5.3.1. General Security Guidelines
5.3.2. Making MySQL Secure Against Attackers
5.3.3. Security-Related mysqld Options
5.3.4. Security Issues with LOAD DATA LOCAL
5.3.5. How to Run MySQL as a Normal User
5.4. The MySQL Access Privilege System
5.4.1. What the Privilege System Does
5.4.2. How the Privilege System Works
5.4.3. Privileges Provided by MySQL
5.4.4. Access Control, Stage 1: Connection Verification
5.4.5. Access Control, Stage 2: Request Verification
5.4.6. When Privilege Changes Take Effect
5.4.7. Causes of Access denied Errors
5.4.8. Password Hashing as of MySQL 4.1
5.5. MySQL User Account Management
5.5.1. MySQL Usernames and Passwords
5.5.2. Adding New User Accounts to MySQL
5.5.3. Removing User Accounts from MySQL
5.5.4. Limiting Account Resources
5.5.5. Assigning Account Passwords
5.5.6. Keeping Your Password Secure
5.5.7. Using SSL for Secure Connections
5.6. Running Multiple MySQL Servers on the Same Machine
5.6.1. Running Multiple Servers on Windows
5.6.2. Running Multiple Servers on Unix
5.6.3. Using Client Programs in a Multiple-Server Environment

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:

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 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.12, “SHOW ENGINES Syntax”.

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

Note

This table is part of an ongoing process to expand and simplify the information provided on these elements. Further improvements to the table, and corresponding descriptions will be applied over the coming months.

NameCmd-LineOption fileSystem VarStatus VarVar ScopeDynamic
Aborted_clients    YesBothNo
Aborted_connects    YesGlobalNo
abort-slave-event-count Yes Yes    
allow-suspicious-udfs Yes Yes    
ansi Yes Yes    
autocommit   Yes Session Yes
auto-increment-increment Yes Yes  Both Yes
- Variable: auto_increment_increment   Yes Both Yes
auto-increment-offset Yes Yes  Both Yes
- Variable: auto_increment_offset   Yes Both Yes
automatic_sp_privileges   Yes Global Yes
back_log Yes Yes Yes GlobalNo
basedir Yes Yes Yes GlobalNo
bdb_cache_size Yes Yes Yes GlobalNo
bdb-home Yes Yes Yes GlobalNo
bdb-lock-detect Yes Yes  GlobalNo
- Variable: bdb_lock_detect   Yes GlobalNo
bdb_log_buffer_size Yes Yes Yes GlobalNo
bdb-logdir Yes Yes Yes GlobalNo
bdb_max_lock Yes Yes Yes GlobalNo
bdb-no-recover Yes Yes    
bdb-shared-data Yes Yes  GlobalNo
- Variable: bdb_shared_data   Yes GlobalNo
bdb-tmpdir Yes Yes Yes GlobalNo
big-tables Yes Yes  Session Yes
- Variable: big_tables   Yes Session Yes
bind-address Yes Yes    
Binlog_cache_disk_use    YesBothNo
binlog_cache_size Yes Yes Yes Global Yes
Binlog_cache_use    YesBothNo
binlog-do-db Yes Yes    
binlog-ignore-db Yes Yes    
bootstrap Yes Yes    
bulk_insert_buffer_size Yes Yes Yes Both Yes
Bytes_received    YesBothNo
Bytes_sent    YesBothNo
character_set_client   Yes Both Yes
character-set-client-handshake Yes     
character_set_connection   Yes Both Yes
character_set_database   Yes Both Yes
character-set-filesystem Yes Yes  Both Yes
- Variable: character_set_filesystem   Yes Both Yes
character_set_results   Yes Both Yes
character-sets-dir Yes Yes  GlobalNo
- Variable: character_sets_dir   Yes GlobalNo
character-set-server Yes Yes  Both Yes
- Variable: character_set_server   Yes Both Yes
character_set_system   Yes GlobalNo
chroot Yes Yes    
collation_connection   Yes Both Yes
collation_database   Yes Both Yes
collation-server Yes Yes  Both Yes
- Variable: collation_server   Yes Both Yes
Com_admin_commands    YesBothNo
Com_alter_db    YesBothNo
Com_alter_event    YesBothNo
Com_alter_table    YesBothNo
Com_analyze    YesBothNo
Com_backup_table    YesBothNo
Com_begin    YesBothNo
Com_call_procedure    YesBothNo
Com_change_db    YesBothNo
Com_change_master    YesBothNo
Com_check    YesBothNo
Com_checksum    YesBothNo
Com_commit    YesBothNo
Com_create_db    YesBothNo
Com_create_event    YesBothNo
Com_create_function    YesBothNo
Com_create_index    YesBothNo
Com_create_table    YesBothNo
Com_create_user    YesBothNo
Com_dealloc_sql    YesBothNo
Com_delete    YesBothNo
Com_delete_multi    YesBothNo
Com_do    YesBothNo
Com_drop_db    YesBothNo
Com_drop_event    YesBothNo
Com_drop_function    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_lock_tables    YesBothNo
Com_optimize    YesBothNo
completion_type Yes Yes Yes Both Yes
Com_preload_keys    YesBothNo
Com_prepare_sql    YesBothNo
Compression    YesBothNo
Com_purge    YesBothNo
Com_purge_before_date    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_events    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_plugins    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_triggers    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
Com_xa_commit    YesBothNo
Com_xa_end    YesBothNo
Com_xa_prepare    YesBothNo
Com_xa_recover    YesBothNo
Com_xa_rollback    YesBothNo
Com_xa_start    YesBothNo
concurrent_insert Yes Yes Yes Global Yes
Connections    YesBothNo
connect_timeout Yes Yes Yes Global Yes
console Yes Yes    
core-file Yes Yes    
Created_tmp_disk_tables    YesBothNo
Created_tmp_files    YesBothNo
Created_tmp_tables    YesBothNo
datadir Yes Yes Yes GlobalNo
date_format   Yes Both Yes
datetime_format Yes Yes Yes Both Yes
debug Yes Yes Yes Both Yes
default-character-set Yes Yes    
defaults-extra-file Yes     
defaults-file Yes     
defaults-group-suffix Yes     
default-storage-engine Yes Yes    
default-table-type Yes Yes    
default-time-zone Yes Yes    
default_week_format Yes Yes Yes Both Yes
Delayed_errors    YesBothNo
delayed_insert_limit Yes Yes Yes Global Yes
Delayed_insert_threads    YesBothNo
delayed_insert_timeout Yes Yes Yes Global Yes
delayed_queue_size Yes Yes Yes Global Yes
Delayed_writes    YesBothNo
delay-key-write Yes Yes  Global Yes
- Variable: delay_key_write   Yes Global Yes
des-key-file Yes Yes    
disconnect-slave-event-count Yes Yes    
div_precision_increment Yes Yes Yes Both Yes
enable-locking Yes     
enable-named-pipe Yes Yes    
enable-pstack Yes Yes    
engine-condition-pushdown Yes Yes  Both Yes
- Variable: engine_condition_pushdown   Yes Both Yes
error_count   Yes SessionNo
exit-info Yes Yes    
expire_logs_days Yes Yes Yes Global Yes
external-locking Yes Yes    
- Variable: external_locking      
flush Yes Yes Yes Global Yes
Flush_commands    YesBothNo
flush_time Yes Yes Yes Global Yes
foreign_key_checks   Yes Session Yes
ft_boolean_syntax Yes Yes Yes Global Yes
ft_max_word_len Yes Yes Yes GlobalNo
ft_min_word_len Yes Yes Yes GlobalNo
ft_query_expansion_limit Yes Yes Yes GlobalNo
ft_stopword_file Yes Yes Yes GlobalNo
gdb Yes Yes    
group_concat_max_len Yes Yes Yes Both Yes
Handler_commit    YesBothNo
Handler_delete    YesBothNo
Handler_discover    YesBothNo
Handler_prepare    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_savepoint    YesBothNo
Handler_savepoint_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_federated_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_ssl   Yes GlobalNo
have_symlink   Yes GlobalNo
help Yes     
hostname   Yes GlobalNo
identity   Yes Session Yes
init_connect Yes Yes Yes Global Yes
init-file Yes Yes  GlobalNo
- Variable: init_file   Yes GlobalNo
init_slave Yes Yes Yes Global Yes
innodb Yes Yes    
innodb_adaptive_hash_index Yes Yes Yes GlobalNo
innodb_additional_mem_pool_size Yes Yes Yes GlobalNo
innodb_autoextend_increment Yes Yes Yes Global Yes
innodb_buffer_pool_awe_mem_mb Yes Yes Yes GlobalNo
Innodb_buffer_pool_pages_data    YesGlobalNo
Innodb_buffer_pool_pages_dirty    YesGlobalNo
Innodb_buffer_pool_pages_flushed    YesGlobalNo
Innodb_buffer_pool_pages_free    YesGlobalNo
Innodb_buffer_pool_pages_latched    YesGlobalNo
Innodb_buffer_pool_pages_misc    YesGlobalNo
Innodb_buffer_pool_pages_total    YesGlobalNo
Innodb_buffer_pool_read_ahead_rnd    YesGlobalNo
Innodb_buffer_pool_read_ahead_seq    YesGlobalNo
Innodb_buffer_pool_read_requests    YesGlobalNo
Innodb_buffer_pool_reads    YesGlobalNo
innodb_buffer_pool_size Yes Yes Yes GlobalNo
Innodb_buffer_pool_wait_free    YesGlobalNo
Innodb_buffer_pool_write_requests    YesGlobalNo
innodb_checksums Yes Yes Yes GlobalNo
innodb_commit_concurrency Yes Yes Yes Global Yes
innodb_concurrency_tickets Yes Yes Yes Global Yes
innodb_data_file_path Yes Yes Yes GlobalNo
Innodb_data_fsyncs    YesGlobalNo
innodb_data_home_dir Yes Yes Yes GlobalNo
Innodb_data_pending_fsyncs    YesGlobalNo
Innodb_data_pending_reads    YesGlobalNo
Innodb_data_pending_writes    YesGlobalNo
Innodb_data_read    YesGlobalNo
Innodb_data_reads    YesGlobalNo
Innodb_data_writes    YesGlobalNo
Innodb_data_written    YesGlobalNo
Innodb_dblwr_pages_written    YesGlobalNo
Innodb_dblwr_writes    YesGlobalNo
innodb_doublewrite Yes Yes Yes GlobalNo
innodb_fast_shutdown Yes Yes Yes Global Yes
innodb_file_io_threads Yes Yes Yes GlobalNo
innodb_file_per_table Yes Yes Yes GlobalNo
innodb_flush_log_at_trx_commit Yes Yes Yes Global Yes
innodb_flush_method Yes Yes Yes GlobalNo
innodb_force_recovery Yes Yes Yes GlobalNo
innodb_locks_unsafe_for_binlog Yes Yes Yes GlobalNo
innodb_lock_wait_timeout Yes Yes Yes GlobalNo
innodb_log_arch_dir Yes Yes Yes GlobalNo
innodb_log_archive Yes Yes Yes GlobalNo
innodb_log_buffer_size Yes Yes Yes GlobalNo
innodb_log_files_in_group Yes Yes Yes GlobalNo
innodb_log_file_size Yes Yes Yes GlobalNo
innodb_log_group_home_dir Yes Yes Yes GlobalNo
Innodb_log_waits    YesGlobalNo
Innodb_log_write_requests    YesGlobalNo
Innodb_log_writes    YesGlobalNo
innodb_max_dirty_pages_pct Yes Yes Yes Global Yes
innodb_max_purge_lag Yes Yes Yes Global Yes
innodb_mirrored_log_groups Yes Yes Yes GlobalNo
innodb_open_files Yes Yes Yes GlobalNo
Innodb_os_log_fsyncs    YesGlobalNo
Innodb_os_log_pending_fsyncs    YesGlobalNo
Innodb_os_log_pending_writes    YesGlobalNo
Innodb_os_log_written    YesGlobalNo
Innodb_pages_created    YesGlobalNo
Innodb_page_size    YesGlobalNo
Innodb_pages_read    YesGlobalNo
Innodb_pages_written    YesGlobalNo
innodb_rollback_on_timeout Yes Yes Yes GlobalNo
Innodb_row_lock_current_waits    YesGlobalNo
Innodb_row_lock_time    YesGlobalNo
Innodb_row_lock_time_avg    YesGlobalNo
Innodb_row_lock_time_max    YesGlobalNo
Innodb_row_lock_waits    YesGlobalNo
Innodb_rows_deleted    YesGlobalNo
Innodb_rows_inserted    YesGlobalNo
Innodb_rows_read    YesGlobalNo
Innodb_rows_updated    YesGlobalNo
innodb-safe-binlog Yes Yes    
innodb_status_file Yes Yes Yes GlobalNo
innodb_support_xa Yes Yes Yes Both Yes
innodb_sync_spin_loops Yes Yes Yes Global Yes
innodb_table_locks Yes Yes Yes Both Yes
innodb_thread_concurrency Yes Yes Yes Global Yes
innodb_thread_sleep_delay Yes Yes Yes Global Yes
insert_id   Yes Session Yes
interactive_timeout Yes Yes Yes Both Yes
join_buffer_size Yes Yes Yes Both Yes
keep_files_on_create Yes Yes Yes Both Yes
Key_blocks_not_flushed    YesBothNo
Key_blocks_unused    YesBothNo
Key_blocks_used    YesBothNo
key_buffer_size Yes Yes Yes Global Yes
key_cache_age_threshold Yes Yes Yes Global Yes
key_cache_block_size Yes Yes Yes Global Yes
key_cache_division_limit Yes Yes Yes Global Yes
Key_read_requests    YesBothNo
Key_reads    YesBothNo
Key_write_requests    YesBothNo
Key_writes    YesBothNo
language Yes Yes Yes GlobalNo
large_files_support   Yes GlobalNo
large-pages Yes Yes  GlobalNo
- Variable: large_pages   Yes GlobalNo
large_page_size   Yes GlobalNo
last_insert_id   Yes Session Yes
Last_query_cost    YesBothNo
lc_time_names   Yes Both Yes
license   Yes GlobalNo
local_infile   Yes Global Yes
local-infile Yes Yes    
locked_in_memory   Yes GlobalNo
log Yes Yes Yes GlobalNo
log_bin   Yes GlobalNo
log-bin Yes Yes    
log-bin-index Yes Yes    
log-bin-trust-function-creators Yes Yes  Global Yes
- Variable: log_bin_trust_function_creators   Yes Global Yes
log-bin-trust-routine-creators Yes Yes  Global Yes
- Variable: log_bin_trust_routine_creators   Yes Global Yes
log-error Yes Yes  GlobalNo
- Variable: log_error   Yes GlobalNo
log-isam Yes Yes    
log-queries-not-using-indexes Yes Yes  Global Yes
- Variable: log_queries_not_using_indexes   Yes Global Yes
log-short-format Yes Yes    
log-slave-updates Yes Yes  GlobalNo
- Variable: log_slave_updates   Yes GlobalNo
log-slow-admin-statements Yes Yes    
log-slow-queries Yes Yes  GlobalNo
- Variable: log_slow_queries   Yes GlobalNo
log-tc Yes Yes    
log-tc-size Yes Yes    
log-warnings Yes Yes  Both Yes
- Variable: log_warnings   Yes Both Yes
long_query_time Yes Yes Yes Both Yes
lower_case_file_system Yes Yes Yes GlobalNo
lower_case_table_names Yes Yes Yes GlobalNo
low-priority-updates Yes Yes  Both Yes
- Variable: low_priority_updates   Yes Both Yes
master-connect-retry Yes Yes    
master-host Yes Yes    
master-info-file Yes Yes    
master-password Yes Yes    
master-port Yes Yes    
master-retry-count Yes Yes    
master-ssl Yes Yes    
master-ssl-ca Yes Yes    
master-ssl-capath Yes Yes    
master-ssl-cert Yes Yes    
master-ssl-cipher Yes Yes    
master-ssl-key Yes Yes    
master-user Yes Yes    
max_allowed_packet Yes Yes Yes Both Yes
max_binlog_cache_size Yes Yes Yes Global Yes
max-binlog-dump-events Yes Yes    
max_binlog_size Yes Yes Yes Global Yes
max_connect_errors Yes Yes Yes Global Yes
max_connections Yes Yes Yes Global Yes
max_delayed_threads Yes Yes Yes Both Yes
max_error_count Yes Yes Yes Both Yes
max_heap_table_size Yes Yes Yes Both Yes
max_insert_delayed_threads   Yes Both Yes
max_join_size Yes Yes Yes Both Yes
max_length_for_sort_data Yes Yes Yes Both Yes
max_prepared_stmt_count Yes Yes Yes Global Yes
max_relay_log_size Yes Yes Yes Global Yes
max_seeks_for_key Yes Yes Yes Both Yes
max_sort_length Yes Yes Yes Both Yes
max_sp_recursion_depth Yes Yes Yes Both Yes
max_tmp_tables Yes Yes Yes Both Yes
Max_used_connections    YesBothNo
max_user_connections Yes Yes Yes Both Yes
max_write_lock_count Yes Yes Yes Global Yes
memlock Yes Yes Yes GlobalNo
merge Yes Yes    
multi_range_count Yes Yes Yes Both Yes
myisam_block_size Yes Yes Yes Both Yes
myisam_data_pointer_size Yes Yes Yes Global Yes
myisam_max_extra_sort_file_size Yes Yes Yes GlobalNo
myisam_max_sort_file_size Yes Yes Yes Global Yes
myisam-recover Yes Yes    
myisam_recover_options   Yes GlobalNo
myisam_repair_threads Yes Yes Yes Both Yes
myisam_sort_buffer_size Yes Yes Yes Both Yes
myisam_stats_method Yes Yes Yes Both Yes
named_pipe   Yes GlobalNo
ndb_autoincrement_prefetch_sz Yes Yes Yes Both Yes
ndb_cache_check_time Yes Yes Yes Global Yes
ndbcluster Yes Yes Yes Both Yes
Ndb_cluster_node_id    YesBothNo
Ndb_config_from_host    YesBothNo
Ndb_config_from_port    YesBothNo
ndb_force_send Yes Yes Yes Both Yes
ndb_index_stat_cache_entries Yes Yes    
ndb_index_stat_enable Yes Yes    
ndb_index_stat_update_freq Yes Yes    
ndb_optimized_node_selection Yes Yes    
ndb_report_thresh_binlog_epoch_slip Yes Yes    
ndb_report_thresh_binlog_mem_usage Yes Yes    
ndb_use_exact_count   Yes Both Yes
ndb_use_transactions Yes Yes    
net_buffer_length Yes Yes Yes Both Yes
net_read_timeout Yes Yes Yes Both Yes
net_retry_count Yes Yes Yes Both Yes
net_write_timeout Yes Yes Yes Both Yes
new Yes Yes Yes Both Yes
no-defaults Yes     
Not_flushed_delayed_rows    YesBothNo
old-passwords Yes Yes  Both Yes
- Variable: old_passwords   Yes Both Yes
old-style-user-limits Yes Yes    
one-thread Yes Yes    
Opened_tables    YesBothNo
Open_files    YesBothNo
open-files-limit Yes Yes  GlobalNo
- Variable: open_files_limit   Yes GlobalNo
Open_streams    YesBothNo
Open_tables    YesBothNo
optimizer_prune_level Yes Yes Yes Both Yes
optimizer_search_depth Yes Yes Yes Both Yes
pid-file Yes Yes  GlobalNo
- Variable: pid_file   Yes GlobalNo
plugin_dir Yes Yes Yes GlobalNo
port Yes Yes Yes GlobalNo
port-open-timeout Yes Yes    
preload_buffer_size Yes Yes Yes Both Yes
prepared_stmt_count   Yes YesGlobalNo
print-defaults Yes     
profiling   Yes Session Yes
profiling_history_size   Yes Both Yes
protocol_version   Yes GlobalNo
Qcache_free_blocks    YesBothNo
Qcache_free_memory    YesBothNo
Qcache_hits    YesBothNo
Qcache_inserts    YesBothNo
Qcache_lowmem_prunes    YesBothNo
Qcache_not_cached    YesBothNo
Qcache_queries_in_cache    YesBothNo
Qcache_total_blocks    YesBothNo
query_alloc_block_size Yes Yes Yes Both Yes
query_cache_limit Yes Yes Yes Global Yes
query_cache_min_res_unit Yes Yes Yes Global Yes
query_cache_size Yes Yes Yes Global Yes
query_cache_type Yes Yes Yes Both Yes
query_cache_wlock_invalidate Yes Yes Yes Both Yes
query_prealloc_size Yes Yes Yes Both Yes
Questions    YesBothNo
rand_seed1   Yes Session Yes
rand_seed2   Yes Session Yes
range_alloc_block_size Yes Yes Yes Both Yes
read_buffer_size Yes Yes Yes Both Yes
read_only Yes Yes Yes Global Yes
read_rnd_buffer_size Yes Yes Yes Both Yes
relay-log Yes Yes    
relay-log-index Yes Yes    
relay-log-info-file Yes Yes    
relay_log_purge Yes Yes Yes Global Yes
relay_log_space_limit Yes Yes Yes GlobalNo
replicate-do-db Yes Yes    
replicate-do-table Yes Yes    
replicate-ignore-db Yes Yes    
replicate-ignore-table Yes Yes    
replicate-rewrite-db Yes Yes    
replicate-same-server-id Yes Yes    
replicate-wild-do-table Yes Yes    
replicate-wild-ignore-table Yes Yes    
report-host Yes Yes  GlobalNo
- Variable: report_host   Yes GlobalNo
report-password Yes Yes  GlobalNo
- Variable: report_password   Yes GlobalNo
report-port Yes Yes  GlobalNo
- Variable: report_port   Yes GlobalNo
report-user Yes Yes  GlobalNo
- Variable: report_user   Yes GlobalNo
rpl_recovery_rank   Yes Global Yes
Rpl_status    YesBothNo
safemalloc-mem-limit Yes Yes    
safe-mode Yes Yes    
safe-user-create Yes Yes    
secure-auth Yes Yes  Global Yes
- Variable: secure_auth   Yes Global Yes
secure-file-priv Yes Yes  GlobalNo
- Variable: secure_file_priv   Yes GlobalNo
Select_full_join    YesBothNo
Select_full_range_join    YesBothNo
Select_range    YesBothNo
Select_range_check    YesBothNo
Select_scan    YesBothNo
server-id Yes Yes  Global Yes
- Variable: server_id   Yes Global Yes
set-variable Yes Yes    
shared_memory   Yes GlobalNo
shared_memory_base_name   Yes GlobalNo
show-slave-auth-info Yes Yes    
skip-bdb Yes Yes    
skip-character-set-client-handshake Yes Yes    
skip-concurrent-insert Yes Yes    
- Variable: concurrent_insert      
skip-external-locking Yes Yes  GlobalNo
- Variable: skip_external_locking   Yes GlobalNo
skip-grant-tables Yes Yes    
skip-host-cache Yes Yes    
skip-innodb Yes Yes    
skip-innodb-checksums Yes Yes    
skip-locking Yes Yes    
skip-log-warnings Yes     
skip-merge Yes Yes    
- Variable:       
skip-name-resolve Yes Yes    
skip-networking Yes Yes  GlobalNo
- Variable: skip_networking   Yes GlobalNo
skip-new Yes Yes    
skip-safemalloc Yes Yes    
skip-show-database Yes Yes  GlobalNo
- Variable: skip_show_database   Yes GlobalNo
skip-slave-start Yes Yes    
skip-ssl Yes Yes    
skip-stack-trace Yes Yes    
skip-symbolic-links Yes     
skip-symlink Yes Yes    
skip-sync-bdb-logs Yes Yes Yes GlobalNo
skip-thread-priority Yes Yes    
slave_compressed_protocol Yes Yes Yes Global Yes
slave-load-tmpdir Yes Yes  GlobalNo
- Variable: slave_load_tmpdir   Yes GlobalNo
slave-net-timeout Yes Yes  Global Yes
- Variable: slave_net_timeout   Yes Global Yes
Slave_open_temp_tables    YesBothNo
Slave_retried_transactions    YesBothNo
Slave_running    YesBothNo
slave-skip-errors Yes Yes  GlobalNo
- Variable: slave_skip_errors   Yes GlobalNo
slave_transaction_retries Yes Yes Yes Global Yes
Slow_launch_threads    YesBothNo
slow_launch_time Yes Yes Yes Global Yes
Slow_queries    YesBothNo
socket Yes Yes Yes GlobalNo
sort_buffer_size Yes Yes Yes Both Yes
Sort_merge_passes    YesBothNo
Sort_range    YesBothNo
Sort_rows    YesBothNo
Sort_scan    YesBothNo
sporadic-binlog-dump-fail Yes Yes    
sql_auto_is_null   Yes Session Yes
sql_big_selects   Yes Both Yes
sql_big_tables   Yes Session Yes
sql_buffer_result   Yes Session Yes
sql_log_bin   Yes Session Yes
sql_log_off   Yes Session Yes
sql_log_update   Yes Session Yes
sql_low_priority_updates   Yes Both Yes
sql_max_join_size   Yes Both Yes
sql-mode Yes Yes  Both Yes
- Variable: sql_mode   Yes Both Yes
sql_notes   Yes Session Yes
sql_quote_show_create   Yes Session Yes
sql_safe_updates   Yes Session Yes
sql_select_limit   Yes Both Yes
sql_slave_skip_counter   Yes Global Yes
sql_warnings   Yes Session Yes
ssl Yes Yes    
ssl-ca Yes Yes  GlobalNo
- Variable: ssl_ca   Yes GlobalNo
ssl-capath Yes Yes  GlobalNo
- Variable: ssl_capath   Yes GlobalNo
ssl-cert Yes Yes  GlobalNo
- Variable: ssl_cert   Yes GlobalNo
ssl-cipher Yes Yes  GlobalNo
- Variable: ssl_cipher   Yes GlobalNo
ssl-key Yes Yes  GlobalNo
- Variable: ssl_key   Yes GlobalNo
standalone Yes Yes    
storage_engine   Yes Both Yes
symbolic-links Yes Yes    
sync-bdb-logs Yes Yes Yes GlobalNo
sync-binlog Yes Yes  Global Yes
- Variable: sync_binlog   Yes Global Yes
sync-frm Yes Yes  Global Yes
- Variable: sync_frm   Yes Global Yes
sysdate-is-now Yes Yes    
system_time_zone   Yes GlobalNo
table_cache Yes Yes Yes Global Yes
Table_locks_immediate    YesBothNo
Table_locks_waited    YesBothNo
table_lock_wait_timeout Yes Yes Yes Global Yes
table_open_cache  Yes Yes Global Yes
table_type   Yes Both Yes
tc-heuristic-recover Yes Yes    
Tc_log_max_pages_used    YesBothNo
Tc_log_page_size    YesBothNo
Tc_log_page_waits    YesBothNo
temp-pool Yes Yes    
thread_cache_size Yes Yes Yes Global Yes
thread_concurrency Yes Yes Yes GlobalNo
Threads_cached    YesBothNo
Threads_connected    YesBothNo
Threads_created    YesBothNo
Threads_running    YesBothNo
thread_stack Yes Yes Yes GlobalNo
timed_mutexes Yes Yes Yes Global Yes
time_format Yes Yes Yes Both Yes
timestamp   Yes Session Yes
time_zone Yes  Yes Both Yes
tmpdir Yes Yes Yes GlobalNo
tmp_table_size Yes Yes Yes Both Yes
transaction_alloc_block_size Yes Yes Yes Both Yes
transaction-isolation Yes Yes    
transaction_prealloc_size Yes Yes Yes Both Yes
tx_isolation   Yes Both Yes
unique_checks   Yes Session Yes
updatable_views_with_limit Yes Yes Yes Both Yes
Uptime    YesBothNo
Uptime_since_flush_status    YesBothNo
user Yes Yes    
verbose Yes     
version Yes  Yes GlobalNo
version_comment   Yes GlobalNo
version_compile_machine   Yes GlobalNo
version_compile_os   Yes GlobalNo
wait_timeout Yes Yes Yes Both Yes
warning_count   Yes SessionNo
warnings Yes Yes    

5.1.2. 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.2, “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 brief summary, execute mysqld --help. 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. Use both the --verbose and --help options to see the full message.

  • --abort-slave-event-count

    Value Set
    Typenumeric
    Default0
    Min Value0

    When this option is set to some positive integer value other than 0 (the default) it affects replication behavior as follows: After the slave SQL thread has started, value log events are allowed to be executed; after that, the slave SQL thread does not receive any more events, just as if the network connection from the master were cut. The slave thread continues to run, and the output from SHOW SLAVE STATUS displays Yes in both the Slave_IO_Running and the Slave_SQL_Running columns, but no further events are read from the relay log.

    This option is used internally by the MySQL test suite for replication testing and debugging. It is not intended for use in a production setting.

  • --allow-suspicious-udfs

    Version Introduced5.0.3
    Value Set
    Typeboolean
    DefaultFALSE

    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 version 5.0.3. See Section 28.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.8.3, “Running MySQL in ANSI Mode”, and Section 5.1.7, “SQL Modes”.

  • --basedir=path, -b path

    Option Sets Variable Yes, basedir
    Variable Namebasedir
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typefilename

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

  • --big-tables

    Option Sets Variable Yes, big_tables
    Variable Namebig-tables
    Variable ScopeSession
    Dynamic Variable Yes
    Value Set
    Typeboolean

    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

    Value Set
    Typestring

    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.

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

    This option is unavailable if MySQL was configured with the --disable-grant-options option. See Section 2.4.15.2, “Typical configure Options”.

  • --character-sets-dir=path

    Option Sets Variable Yes, character_sets_dir
    Variable Namecharacter-sets-dir
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typefilename

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

  • --character-set-client-handshake

    Value Set
    Typeboolean
    DefaultTRUE

    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 behave like MySQL 4.0.

  • --character-set-filesystem=charset_name

    Version Introduced5.0.19
    Option Sets Variable Yes, character_set_filesystem
    Variable Namecharacter_set_filesystem
    Variable ScopeBoth
    Dynamic Variable Yes
    Value Set
    Typestring

    The filesystem character set. This option sets the character_set_filesystem system variable. It was added in MySQL 5.0.19.

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

    Option Sets Variable Yes, character_set_server
    Variable Namecharacter_set_server
    Variable ScopeBoth
    Dynamic Variable Yes
    Value Set
    Typestring

    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 non-default character set, you should also use --collation-server to specify the collation.

  • --chroot=path, -r path

    Value Set
    Typefilename

    Put the mysqld server in a closed environment during startup by using the chroot() system call. This is a recommended security measure. Note that use of this option somewhat limits LOAD DATA INFILE and SELECT ... INTO OUTFILE.

  • --collation-server=collation_name

    Option Sets Variable Yes, collation_server
    Variable Namecollation_server
    Variable ScopeBoth
    Dynamic Variable Yes
    Value Set
    Typestring

    Use collation_name as the default server collation. See Section 9.2, “The Character Set Used for Data and Sorting”.

  • --console

    Option Sets Variable Yes, console
    Platform Specificwindows

    (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

    Value Set
    Typeboolean
    DefaultTRUE

    Write a core file if mysqld dies. For some systems, you must also specify the --core-file-size option to mysqld_safe. See Section 4.3.2, “mysqld_safe — MySQL Server Startup Script”. Note that on some systems, such as Solaris, you do not get a core file if you are also using the --user option.

  • --datadir=path, -h path

    Option Sets Variable Yes, datadir
    Variable Namedatadir
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typefilename

    The path to the data directory.

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

    Variable Namedebug
    Variable ScopeBoth
    Dynamic Variable Yes
    Value Set
    Typestring
    Default'd:t:o,/tmp/mysqld.trace

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

    As of MySQL 5.0.25, using --with-debug to configure MySQL with debugging support enables you to use the --debug="d,parser_debug" option when you start the server. This causes the Bison parser that is used to process SQL statements to dump a parser trace to the server's standard error output. Typically, this output is written to the error log.

  • --default-character-set=charset_name (DEPRECATED)

    Deprecated5.0
    Value Set
    Typestring

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

  • --default-collation=collation_name

    Variable Namedefault-collation
    Variable Scope 
    Dynamic VariableNo
    Deprecated4.1.3
    Value Set
    Typestring

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

  • --default-storage-engine=type

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

  • --default-table-type=type

    Deprecated5.0, by default-storage-engine
    Value Set
    Typestring

    This option is a synonym for --default-storage-engine.

  • --default-time-zone=timezone

    Value Set
    Typestring

    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.

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

    Option Sets Variable Yes, delay_key_write
    Variable Namedelay-key-write
    Variable ScopeGlobal
    Dynamic Variable Yes
    Value Set
    Typeenumeration
    DefaultON
    Valid ValuesON, OFF, 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. See Section 7.5.2, “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.

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

  • --disconnect-slave-event-count

    Value Set
    Typenumeric
    Default0

    This option is used internally by the MySQL test suite for replication testing and debugging.

  • --enable-named-pipe

    Platform Specificwindows

    Enable support for named pipes. This option can be used only with the mysqld-nt and mysqld-debug servers that support named-pipe connections.

  • --enable-pstack

    Value Set
    Typeboolean
    DefaultFALSE

    Print a symbolic stack trace on failure.

  • --engine-condition-pushdown={ON|OFF}

    Version Introduced5.0.3
    Option Sets Variable Yes, engine_condition_pushdown
    Variable Nameengine_condition_pushdown
    Variable ScopeBoth
    Dynamic Variable Yes
    Value Set (>= 5.0.3)
    Typeboolean
    DefaultOFF

    When the value of this option is 0 (OFF), a query such as SELECT * FROM t WHERE mycol = 42, where mycol is a non-indexed column, is executed as a full table scan. The storage engine sends every row to the MySQL server, which applies the WHERE condition. If engine_condition_pushdown is set to 1 (ON), the condition is “pushed down” to the storage engine, which uses the condition to perform the scan, and sends back to the MySQL server only those rows that match the condition. By default, this variable is OFF.

    In MySQL 5.0, this option is useful only with the NDBCLUSTER storage engine. However, we intend to implement it for additional storage engines in future MySQL releases.

    Setting this option to ON on a MySQL Server acting as a MySQL Cluster SQL node causes WHERE conditions on unindexed columns to be evaluated on the cluster's data nodes and only the rows that match to be sent back to the SQL node that issued the query. This means the amount of cluster data that must be sent over the network is greatly reduced, increasing the efficiency with which results are returned.

    For more information, see Section 7.2.7, “Condition Pushdown Optimization”.

    This variable was added in MySQL 5.0.3.

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

    Value Set
    Typenumeric

    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

    Option Sets Variable Yes, external_locking
    Disabled byskip-external-locking
    Value Set
    Typeboolean
    DefaultFALSE

    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 previously was named --enable-locking.

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

  • --flush

    Variable Nameflush
    Variable ScopeGlobal
    Dynamic Variable Yes
    Value Set
    Typeboolean
    DefaultOFF

    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 B.1.4.2, “What to Do If MySQL Keeps Crashing”.

  • --gdb

    Value Set
    Typeboolean
    DefaultFALSE

    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.

  • --init-file=file_name

    Option Sets Variable Yes, init_file
    Variable Nameinit_file
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typefilename

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

    This option is unavailable if MySQL was configured with the --disable-grant-options option. See Section 2.4.15.2, “Typical configure Options”.

  • --innodb-safe-binlog

    Version Introduced5.0.1
    Deprecated5.0.3
    Value Set (<= 5.0.3)
    Typeboolean

    Adds consistency guarantees between the content of InnoDB tables and the binary log. See Section 5.2.3, “The Binary Log”. This option was removed in MySQL 5.0.3, having been made obsolete by the introduction of XA transaction support.

  • --innodb-xxx

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

  • --language=lang_name, -L lang_name

    Option Sets Variable Yes, language
    Variable Namelanguage
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typefilename
    Default/usr/local/mysql/share/mysql/english/

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

  • --large-pages

    Version Introduced5.0.3
    Option Sets Variable Yes, large_pages
    Variable Namelarge_pages
    Variable ScopeGlobal
    Dynamic VariableNo
    Platform Specificlinux
    Value Set
    Typelinuxboolean
    DefaultFALSE 

    Some hardware/operating system architectures support memory pages greater than the default (usually 4KB). The actual implementation of this support depends on the underlying hardware and OS. Applications that perform a lot of memory accesses may obtain performance improvements by using large pages due to reduced Translation Lookaside Buffer (TLB) misses.

    Currently, MySQL supports only the Linux implementation of large pages support (which is called HugeTLB in Linux). We have plans to extend this support to FreeBSD, Solaris and possibly other platforms.

    Before large pages can be used on Linux, it is necessary to configure the HugeTLB memory pool. For reference, consult the hugetlbpage.txt file in the Linux kernel source.

    This option is disabled by default. It was added in MySQL 5.0.3.

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

    Option Sets Variable Yes, log
    Variable Namelog
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typestring
    DefaultOFF

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

  • --log-bin[=base_name]

    Value Set
    Typefilename

    Enable binary logging. The server logs all statements that change data to the binary log, which is used for backup and replication. See Section 5.2.3, “The Binary Log”.

    The option value, if given, is the basename for the log sequence. The server creates binary log files in sequence by adding a numeric suffix to the basename. It is recommended that you specify a basename (see Section B.1.8.1, “Open Issues in MySQL”, for the reason). Otherwise, MySQL uses host_name-bin as the basename.

  • --log-bin-index[=file_name]

    Value Set
    Typefilename

    The index file for binary log filenames. See Section 5.2.3, “The Binary Log”. If you omit the filename, and if you didn't specify one with --log-bin, MySQL uses host_name-bin.index as the filename.

  • --log-bin-trust-function-creators[={0|1}]

    Version Introduced5.0.16
    Option Sets Variable Yes, log_bin_trust_function_creators
    Variable Namelog_bin_trust_function_creators
    Variable ScopeGlobal
    Dynamic Variable Yes
    Value Set
    Typeboolean
    DefaultFALSE

    With no argument or an argument of 1, this option sets the log_bin_trust_function_creators system variable to 1. With an argument of 0, this option sets the system variable to 0. log_bin_trust_function_creators affects how MySQL enforces restrictions on stored function and trigger creation. See Section 21.4, “Binary Logging of Stored Routines and Triggers”.

    This option was added in MySQL 5.0.16.

  • --log-bin-trust-routine-creators[={0|1}]

    Version Introduced5.0.6
    Option Sets Variable Yes, log_bin_trust_routine_creators
    Variable Namelog-bin-trust-routine-creators
    Variable ScopeGlobal
    Dynamic Variable Yes
    Deprecated5.0.16, by log-bin-trust-function-creators
    Value Set
    Typeboolean
    DefaultFALSE

    This is the old name for --log-bin-trust-function-creators. Before MySQL 5.0.16, it also applies to stored procedures, not just stored functions and sets the log_bin_trust_routine_creators system variable. As of 5.0.16, this option is deprecated. It is recognized for backward compatibility but its use results in a warning.

    This option was added in MySQL 5.0.6.

  • --log-error[=file_name]

    Option Sets Variable Yes, log_error
    Variable Namelog_error
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typefilename

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

  • --log-isam[=file_name]

    Value Set
    Typefilename

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

  • --log-long-format (DEPRECATED)

    Deprecated4.1

    Log extra information to the update log, binary update log, and slow query log, if they have been activated. For example, the username and timestamp are logged for all queries. This option is deprecated, as it now represents the default logging behavior. (See the description for --log-short-format.) 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

    Option Sets Variable Yes, log_queries_not_using_indexes
    Variable Namelog_queries_not_using_indexes
    Variable ScopeGlobal
    Dynamic Variable Yes
    Value Set
    Typeboolean

    If you are using this option with --log-slow-queries, queries that do not use indexes are logged to the slow query log. See Section 5.2.4, “The Slow Query Log”.

  • --log-short-format

    Value Set
    Typeboolean
    DefaultFALSE

    Log less information to the update log, binary update log, and slow query log, if they have been activated. For example, the username and timestamp are not logged for queries.

  • --log-slow-admin-statements

    Value Set
    Typeboolean
    DefaultFALSE

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

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

    Option Sets Variable Yes, log_slow_queries
    Variable Namelog_slow_queries
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typeboolean

    Log all queries that have taken more than long_query_time seconds to execute to this file. See Section 5.2.4, “The Slow Query Log”. See the descriptions of the --log-long-format and --log-short-format options for details.

  • --log-tc=file_name

    Version Introduced5.0.3
    Value Set
    Typefilename
    Defaulttc.log

    The name of the memory-mapped transaction coordinator log file (for XA transactions that affect multiple storage engines when the binary log is disabled). The default name is tc.log. The file is created under the data directory if not given as a full pathname. Currently, this option is unused. Added in MySQL 5.0.3.

  • --log-tc-size=size

    Version Introduced5.0.3
    Value Set
    Typenumeric
    Default24576
    Max Value4294967295

    The size in bytes of the memory-mapped transaction coordinator log. The default size is 24KB. Added in MySQL 5.0.3.

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

    Option Sets Variable Yes, log-warnings
    Variable Namelog_warnings
    Variable ScopeBoth
    Dynamic Variable Yes
    Disabled byskip-log-warnings
    Value Set
    Typenumeric
    Default1

    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 (1) by default, and the default level value if omitted is 1. To disable this option, use --log-warnings=0. If the value is greater than 1, aborted connections are written to the error log. See Section B.1.2.11, “Communication Errors and Aborted Connections”.

  • --low-priority-updates

    Option Sets Variable Yes, low_priority_updates
    Variable Namelow_priority_updates
    Variable ScopeBoth
    Dynamic Variable Yes
    Value Set
    Typeboolean
    DefaultFALSE

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

  • --max-binlog-dump-events

    Value Set
    Typenumeric
    Default0

    This option is used internally by the MySQL test suite for replication testing and debugging.

  • --memlock

    Variable Namelocked_in_memory
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typeboolean
    DefaultFALSE

    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.3.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-recover[=option[,option]...]]

    Value Set
    Typeenumeration
    DefaultOFF
    Valid ValuesDEFAULT, BACKUP, FORCE, QUICK

    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. Specifying the option with no argument is the same as specifying DEFAULT, and specifying with an explicit value of "" disables recovery (same as not giving the option). If recovery is enabled, 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.
    QUICKDon't check the rows in the table if there aren't 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”.

  • --old-passwords

    Option Sets Variable Yes, old_passwords
    Variable Nameold_passwords
    Variable ScopeBoth
    Dynamic Variable Yes
    Value Set
    Typeboolean
    DefaultFALSE

    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.4.8, “Password Hashing as of MySQL 4.1”.

  • --old-style-user-limits

    Version Introduced5.0.3
    Value Set
    Typeboolean
    DefaultFALSE

    Enable old-style user limits. (Before MySQL 5.0.3, account resource limits were counted separately for each host from which a user connected rather than per account row in the user table.) See Section 5.5.4, “Limiting Account Resources”. This option was added in MySQL 5.0.3.

  • --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

    Option Sets Variable Yes, open_files_limit
    Variable Nameopen_files_limit
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typenumeric
    Default0
    Range0-65535

    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

    Option Sets Variable Yes, pid_file
    Variable Namepid_file
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typefilename

    The pathname 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

    Option Sets Variable Yes, port
    Variable Nameport
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typenumeric
    Default3306

    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.

  • --port-open-timeout=num

    Version Introduced5.0.19
    Value Set
    Typenumeric
    Default0

    On some systems, when the server is stopped, the TCP/IP port might not become available immediately. If the server is restarted quickly afterward, its attempt to reopen the port can fail. This option indicates how many seconds the server should wait for the TCP/IP port to become free if it cannot be opened. The default is not to wait. This option was added in MySQL 5.0.19.

  • --safe-mode

    Deprecated5.0

    Skip some optimization stages.

  • --safe-show-database (DEPRECATED)

    Option Sets Variable Yes, safe_show_database
    Variable Namesafe_show_database
    Variable ScopeGlobal
    Dynamic Variable Yes
    Deprecated4.0.2
    Value Set
    Typeboolean

    See Section 5.4.3, “Privileges Provided by MySQL”.

  • --safe-user-create

    Option Sets Variable Yes, safe-user-create
    Value Set
    Typeboolean
    DefaultFALSE

    If this option is enabled, a user cannot create new MySQL users by using the GRANT statement unless the user has the INSERT privilege for the mysql.user table or any column in the table. If you want a user to have the ability to create new users that have those privileges that the user has the right to grant, you should grant the user the following privilege:

    GRANT INSERT(user) ON mysql.user TO 'user_name'@'host_name';
    

    This ensures that the user cannot change any privilege columns directly, but has to use the GRANT statement to give privileges to other users.

  • --secure-auth

    Option Sets Variable Yes, secure_auth
    Variable Namesecure_auth
    Variable ScopeGlobal
    Dynamic Variable Yes
    Value Set
    Typeboolean
    DefaultFALSE

    Disallow authentication by clients that attempt to use accounts that have old (pre-4.1) passwords.

  • --secure-file-priv=path

    Version Introduced5.0.38
    Option Sets Variable Yes, secure_file_priv
    Variable Namesecure_file_priv
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typestring

    This option limits the effect of the LOAD_FILE() function and the LOAD DATA and SELECT ... INTO OUTFILE statements to work only with files in the specified directory.

    This option was added in MySQL 5.0.38.

  • --shared-memory

    Enable shared-memory connections by local clients. This option is available only on Windows.

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

  • --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-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 not to use 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).

    This option is unavailable if MySQL was configured with the --disable-grant-options option. See Section 2.4.15.2, “Typical configure Options”.

  • --skip-host-cache

    Do not use the internal hostname cache for faster name-to-IP resolution. Instead, query the DNS server every time a client connects. See Section 7.5.10, “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-merge

    Disable the MERGE storage engine. This option was added in MySQL 5.0.24. 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 hostnames 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.10, “How MySQL Uses DNS”.

  • --skip-networking

    Don't 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.10, “How MySQL Uses DNS”.

  • --sporadic-binlog-dump-fail

    Value Set
    Typeboolean
    DefaultFALSE

    This option is used internally by the MySQL test suite for replication testing and debugging.

  • --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.5.7.3, “SSL Command Options”.

  • --standalone

    Platform Specificwindows

    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:

  • --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 don't need it by using the --skip-safemalloc option.

  • --skip-show-database

    Option Sets Variable Yes, skip_show_database
    Variable Nameskip_show_database
    Variable ScopeGlobal
    Dynamic VariableNo

    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

    Don't 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

    Option Sets Variable Yes, socket
    Variable Namesocket
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typelinuxfilename
    Default/tmp/mysql.sock 
    Value Set
    Typehpuxfilename
    Default/tmp/mysql.sock 
    Value Set
    Typesolarisfilename
    Default/tmp/mysql.sock 
    Value Set
    Typemacosxfilename
    Default/tmp/mysql.sock 

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

    Option Sets Variable Yes, sql_mode
    Variable Namesql_mode
    Variable ScopeBoth
    Dynamic Variable Yes
    Value Set
    Typeenumeration
    Default''
    Valid ValuesALLOW_INVALID_DATES, ANSI_QUOTES, ERROR_FOR_DIVISION_BY_ZERO, HIGH_NOT_PRECEDENCE, IGNORE_SPACE, NO_AUTO_CREATE_USER, NO_AUTO_VALUE_ON_ZERO, NO_BACKSLASH_ESCAPES, NO_DIR_IN_CREATE, NO_ENGINE_SUBSTITUTION, NO_FIELD_OPTIONS, NO_KEY_OPTIONS, NO_TABLE_OPTIONS, NO_UNSIGNED_SUBTRACTION, NO_ZERO_DATE, NO_ZERO_IN_DATE, ONLY_FULL_GROUP_BY, PAD_CHAR_TO_FULL_LENGTH, PIPES_AS_CONCAT, REAL_AS_FLOAT, STRICT_ALL_TABLES, STRICT_TRANS_TABLES

    Set the SQL mode. See Section 5.1.7, “SQL Modes”.

  • --sysdate-is-now

    Version Introduced5.0.20
    Value Set
    Typeboolean
    DefaultFALSE

    As of MySQL 5.0.13, SYSDATE() by default returns the time at which it executes, not the time at which the statement in which it occurs begins executing. This differs from the behavior of NOW(). This option causes SYSDATE() to be an alias for NOW(). For information about the implications for binary logging and replication, see the description for SYSDATE() in Section 11.6, “Date and Time Functions” and for SET TIMESTAMP in Section 5.1.4, “Session System Variables”.

    This option was added in MySQL 5.0.20.

  • --tc-heuristic-recover={COMMIT|ROLLBACK}

    Version Introduced5.0.3
    Value Set
    Typeenumeration
    Valid ValuesCOMMIT, RECOVER

    The type of decision to use in the heuristic recovery process. Currently, this option is unused. Added in MySQL 5.0.3.

  • --temp-pool

    Value Set
    Typeboolean
    DefaultTRUE

    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

    Value Set
    Typeenumeration
    Valid ValuesREAD-UNCOMMTTED, READ-COMMITTED, REPEATABLE-READ, SERIALIZABLE

    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

    Option Sets Variable Yes, tmpdir
    Variable Nametmpdir
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typefilename

    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. 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 filesystem or to a directory that is cleared when the server host restarts. For more information about the storage location of temporary files, see Section B.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}

    Value Set
    Typestring

    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.3.1, “General Security Guidelines”.

    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.

  • --version, -V

    Variable Nameversion
    Variable ScopeGlobal
    Dynamic VariableNo

    Display version information and exit.

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 -O var_name=value syntax. This syntax is deprecated.

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, “System Variables”, provides a full description for all variables, and additional information for setting them at server startup and runtime. Section 7.5.2, “Tuning Server Parameters”, includes information on optimizing the server by tuning system variables.

5.1.3. 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. 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:

    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:

    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 are present in all MySQL 5.0 releases. For historical information concerning their implementation, please see http://dev.mysql.com/doc/refman/4.1/en/.

The following table lists all available system variables:

NameCmd-LineOption fileSystem VarVar ScopeDynamic
autocommit   YesSession Yes
auto-increment-increment Yes Yes   Yes
- Variable: auto_increment_increment   YesBoth Yes
auto-increment-offset Yes Yes   Yes
- Variable: auto_increment_offset   YesBoth Yes
automatic_sp_privileges   YesGlobal Yes
back_log Yes Yes YesGlobalNo
basedir Yes Yes YesGlobalNo
bdb_cache_size Yes Yes YesGlobalNo
bdb-home Yes Yes YesGlobalNo
bdb-lock-detect Yes Yes  No
- Variable: bdb_lock_detect   YesGlobalNo
bdb_log_buffer_size Yes Yes YesGlobalNo
bdb-logdir Yes Yes YesGlobalNo
bdb_max_lock Yes Yes YesGlobalNo
bdb-shared-data Yes Yes  No
- Variable: bdb_shared_data   YesGlobalNo
bdb-tmpdir Yes Yes YesGlobalNo
big-tables Yes Yes   Yes
- Variable: big_tables   YesSession Yes
binlog_cache_size Yes Yes YesGlobal Yes
bulk_insert_buffer_size Yes Yes YesBoth Yes
character_set_client   YesBoth Yes
character_set_connection   YesBoth Yes
character_set_database   YesBoth Yes
character-set-filesystem Yes Yes   Yes
- Variable: character_set_filesystem   YesBoth Yes
character_set_results   YesBoth Yes
character-sets-dir Yes Yes  No
- Variable: character_sets_dir   YesGlobalNo
character-set-server Yes Yes   Yes
- Variable: character_set_server   YesBoth Yes
character_set_system   YesGlobalNo
collation_connection   YesBoth Yes
collation_database   YesBoth Yes
collation-server Yes Yes   Yes
- Variable: collation_server   YesBoth Yes
completion_type Yes Yes YesBoth Yes
concurrent_insert Yes Yes YesGlobal Yes
connect_timeout Yes Yes YesGlobal Yes
datadir Yes Yes YesGlobalNo
date_format   YesBoth Yes
datetime_format Yes Yes YesBoth Yes
debug Yes Yes YesBoth Yes
default_week_format Yes Yes YesBoth Yes
delayed_insert_limit Yes Yes YesGlobal Yes
delayed_insert_timeout Yes Yes YesGlobal Yes
delayed_queue_size Yes Yes YesGlobal Yes
delay-key-write Yes Yes   Yes
- Variable: delay_key_write   YesGlobal Yes
div_precision_increment Yes Yes YesBoth Yes
engine-condition-pushdown Yes Yes   Yes
- Variable: engine_condition_pushdown   YesBoth Yes
error_count   YesSessionNo
expire_logs_days Yes Yes YesGlobal Yes
flush Yes Yes YesGlobal Yes
flush_time Yes Yes YesGlobal Yes
foreign_key_checks   YesSession Yes
ft_boolean_syntax Yes Yes YesGlobal Yes
ft_max_word_len Yes Yes YesGlobalNo
ft_min_word_len Yes Yes YesGlobalNo
ft_query_expansion_limit Yes Yes YesGlobalNo
ft_stopword_file Yes Yes YesGlobalNo
group_concat_max_len Yes Yes YesBoth Yes
have_archive   YesGlobalNo
have_bdb   YesGlobalNo
have_blackhole_engine   YesGlobalNo
have_compress   YesGlobalNo
have_crypt   YesGlobalNo
have_csv   YesGlobalNo
have_example_engine   YesGlobalNo
have_federated_engine   YesGlobalNo
have_geometry   YesGlobalNo
have_innodb   YesGlobalNo
have_isam   YesGlobalNo
have_merge_engine   YesGlobalNo
have_ndbcluster   YesGlobalNo
have_openssl   YesGlobalNo
have_query_cache   YesGlobalNo
have_raid   YesGlobalNo
have_rtree_keys   YesGlobalNo
have_ssl   YesGlobalNo
have_symlink   YesGlobalNo
hostname   YesGlobalNo
identity   YesSession Yes
init_connect Yes Yes YesGlobal Yes
init-file Yes Yes  No
- Variable: init_file   YesGlobalNo
init_slave Yes Yes YesGlobal Yes
innodb_adaptive_hash_index Yes Yes YesGlobalNo
innodb_additional_mem_pool_size Yes Yes YesGlobalNo
innodb_autoextend_increment Yes Yes YesGlobal Yes
innodb_buffer_pool_awe_mem_mb Yes Yes YesGlobalNo
innodb_buffer_pool_size Yes Yes YesGlobalNo
innodb_checksums Yes Yes YesGlobalNo
innodb_commit_concurrency Yes Yes YesGlobal Yes
innodb_concurrency_tickets Yes Yes YesGlobal Yes
innodb_data_file_path Yes Yes YesGlobalNo
innodb_data_home_dir Yes Yes YesGlobalNo
innodb_doublewrite Yes Yes YesGlobalNo
innodb_fast_shutdown Yes Yes YesGlobal Yes
innodb_file_io_threads Yes Yes YesGlobalNo
innodb_file_per_table Yes Yes YesGlobalNo
innodb_flush_log_at_trx_commit Yes Yes YesGlobal Yes
innodb_flush_method Yes Yes YesGlobalNo
innodb_force_recovery Yes Yes YesGlobalNo
innodb_locks_unsafe_for_binlog Yes Yes YesGlobalNo
innodb_lock_wait_timeout Yes Yes YesGlobalNo
innodb_log_arch_dir Yes Yes YesGlobalNo
innodb_log_archive Yes Yes YesGlobalNo
innodb_log_buffer_size Yes Yes YesGlobalNo
innodb_log_files_in_group Yes Yes YesGlobalNo
innodb_log_file_size Yes Yes YesGlobalNo
innodb_log_group_home_dir Yes Yes YesGlobalNo
innodb_max_dirty_pages_pct Yes Yes YesGlobal Yes
innodb_max_purge_lag Yes Yes YesGlobal Yes
innodb_mirrored_log_groups Yes Yes YesGlobalNo
innodb_open_files Yes Yes YesGlobalNo
innodb_rollback_on_timeout Yes Yes YesGlobalNo
innodb_status_file Yes Yes YesGlobalNo
innodb_support_xa Yes Yes YesBoth Yes
innodb_sync_spin_loops Yes Yes YesGlobal Yes
innodb_table_locks Yes Yes YesBoth Yes
innodb_thread_concurrency Yes Yes YesGlobal Yes
innodb_thread_sleep_delay Yes Yes YesGlobal Yes
insert_id   YesSession Yes
interactive_timeout Yes Yes YesBoth Yes
join_buffer_size Yes Yes YesBoth Yes
keep_files_on_create Yes Yes YesBoth Yes
key_buffer_size Yes Yes YesGlobal Yes
key_cache_age_threshold Yes Yes YesGlobal Yes
key_cache_block_size Yes Yes YesGlobal Yes
key_cache_division_limit Yes Yes YesGlobal Yes
language Yes Yes YesGlobalNo
large_files_support   YesGlobalNo
large-pages Yes Yes  No
- Variable: large_pages   YesGlobalNo
large_page_size   YesGlobalNo
last_insert_id   YesSession Yes
lc_time_names   YesBoth Yes
license   YesGlobalNo
local_infile   YesGlobal Yes
locked_in_memory   YesGlobalNo
log Yes Yes YesGlobalNo
log_bin   YesGlobalNo
log-bin-trust-function-creators Yes Yes   Yes
- Variable: log_bin_trust_function_creators   YesGlobal Yes
log-bin-trust-routine-creators Yes Yes   Yes
- Variable: log_bin_trust_routine_creators   YesGlobal Yes
log-error Yes Yes  No
- Variable: log_error   YesGlobalNo
log-queries-not-using-indexes Yes Yes   Yes
- Variable: log_queries_not_using_indexes   YesGlobal Yes
log-slave-updates Yes Yes  No
- Variable: log_slave_updates   YesGlobalNo
log-slow-queries Yes Yes  No
- Variable: log_slow_queries   YesGlobalNo
log-warnings Yes Yes   Yes
- Variable: log_warnings   YesBoth Yes
long_query_time Yes Yes YesBoth Yes
lower_case_file_system Yes Yes YesGlobalNo
lower_case_table_names Yes Yes YesGlobalNo
low-priority-updates Yes Yes   Yes
- Variable: low_priority_updates   YesBoth Yes
max_allowed_packet Yes Yes YesBoth Yes
max_binlog_cache_size Yes Yes YesGlobal Yes
max_binlog_size Yes Yes YesGlobal Yes
max_connect_errors Yes Yes YesGlobal Yes
max_connections Yes Yes YesGlobal Yes
max_delayed_threads Yes Yes YesBoth Yes
max_error_count Yes Yes YesBoth Yes
max_heap_table_size Yes Yes YesBoth Yes
max_insert_delayed_threads   YesBoth Yes
max_join_size Yes Yes YesBoth Yes
max_length_for_sort_data Yes Yes YesBoth Yes
max_prepared_stmt_count Yes Yes YesGlobal Yes
max_relay_log_size Yes Yes YesGlobal Yes
max_seeks_for_key Yes Yes YesBoth Yes
max_sort_length Yes Yes YesBoth Yes
max_sp_recursion_depth Yes Yes YesBoth Yes
max_tmp_tables Yes Yes YesBoth Yes
max_user_connections Yes Yes YesBoth Yes
max_write_lock_count Yes Yes YesGlobal Yes
memlock Yes Yes YesGlobalNo
multi_range_count Yes Yes YesBoth Yes
myisam_block_size Yes Yes YesBoth Yes
myisam_data_pointer_size Yes Yes YesGlobal Yes
myisam_max_extra_sort_file_size Yes Yes YesGlobalNo
myisam_max_sort_file_size Yes Yes YesGlobal Yes
myisam_recover_options   YesGlobalNo
myisam_repair_threads Yes Yes YesBoth Yes
myisam_sort_buffer_size Yes Yes YesBoth Yes
myisam_stats_method Yes Yes YesBoth Yes
named_pipe   YesGlobalNo
ndb_autoincrement_prefetch_sz Yes Yes YesBoth Yes
ndb_cache_check_time Yes Yes YesGlobal Yes
ndbcluster Yes Yes YesBoth Yes
ndb_force_send Yes Yes YesBoth Yes
ndb_use_exact_count   YesBoth Yes
net_buffer_length Yes Yes YesBoth Yes
net_read_timeout Yes Yes YesBoth Yes
net_retry_count Yes Yes YesBoth Yes
net_write_timeout Yes Yes YesBoth Yes
new Yes Yes YesBoth Yes
old-passwords Yes Yes   Yes
- Variable: old_passwords   YesBoth Yes
open-files-limit Yes Yes  No
- Variable: open_files_limit   YesGlobalNo
optimizer_prune_level Yes Yes YesBoth Yes
optimizer_search_depth Yes Yes YesBoth Yes
pid-file Yes Yes  No
- Variable: pid_file   YesGlobalNo
plugin_dir Yes Yes YesGlobalNo
port Yes Yes YesGlobalNo
preload_buffer_size Yes Yes YesBoth Yes
prepared_stmt_count   YesGlobalNo
profiling   YesSession Yes
profiling_history_size   YesBoth Yes
protocol_version   YesGlobalNo
query_alloc_block_size Yes Yes YesBoth Yes
query_cache_limit Yes Yes YesGlobal Yes
query_cache_min_res_unit Yes Yes YesGlobal Yes
query_cache_size Yes Yes YesGlobal Yes
query_cache_type Yes Yes YesBoth Yes
query_cache_wlock_invalidate Yes Yes YesBoth Yes
query_prealloc_size Yes Yes YesBoth Yes
rand_seed1   YesSession Yes
rand_seed2   YesSession Yes
range_alloc_block_size Yes Yes YesBoth Yes
read_buffer_size Yes Yes YesBoth Yes
read_only Yes Yes YesGlobal Yes
read_rnd_buffer_size Yes Yes YesBoth Yes
relay_log_purge Yes Yes YesGlobal Yes
relay_log_space_limit Yes Yes YesGlobalNo
report-host Yes Yes  No
- Variable: report_host   YesGlobalNo
report-password Yes Yes  No
- Variable: report_password   YesGlobalNo
report-port Yes Yes  No
- Variable: report_port   YesGlobalNo
report-user Yes Yes  No
- Variable: report_user   YesGlobalNo
rpl_recovery_rank   YesGlobal Yes
secure-auth Yes Yes   Yes
- Variable: secure_auth   YesGlobal Yes
secure-file-priv Yes Yes  No
- Variable: secure_file_priv   YesGlobalNo
server-id Yes Yes   Yes
- Variable: server_id   YesGlobal Yes
shared_memory   YesGlobalNo
shared_memory_base_name   YesGlobalNo
skip-external-locking Yes Yes  No
- Variable: skip_external_locking   YesGlobalNo
skip-networking Yes Yes  No
- Variable: skip_networking   YesGlobalNo
skip-show-database Yes Yes  No
- Variable: skip_show_database   YesGlobalNo
skip-sync-bdb-logs Yes Yes YesGlobalNo
slave_compressed_protocol Yes Yes YesGlobal Yes
slave-load-tmpdir Yes Yes  No
- Variable: slave_load_tmpdir   YesGlobalNo
slave-net-timeout Yes Yes   Yes
- Variable: slave_net_timeout   YesGlobal Yes
slave-skip-errors Yes Yes  No
- Variable: slave_skip_errors   YesGlobalNo
slave_transaction_retries Yes Yes YesGlobal Yes
slow_launch_time Yes Yes YesGlobal Yes
socket Yes Yes YesGlobalNo
sort_buffer_size Yes Yes YesBoth Yes
sql_auto_is_null   YesSession Yes
sql_big_selects   YesBoth Yes
sql_big_tables   YesSession Yes
sql_buffer_result   YesSession Yes
sql_log_bin   YesSession Yes
sql_log_off   YesSession Yes
sql_log_update   YesSession Yes
sql_low_priority_updates   YesBoth Yes
sql_max_join_size   YesBoth Yes
sql-mode Yes Yes   Yes
- Variable: sql_mode   YesBoth Yes
sql_notes   YesSession Yes
sql_quote_show_create   YesSession Yes
sql_safe_updates   YesSession Yes
sql_select_limit   YesBoth Yes
sql_slave_skip_counter   YesGlobal Yes
sql_warnings   YesSession Yes
ssl-ca Yes Yes  No
- Variable: ssl_ca   YesGlobalNo
ssl-capath Yes Yes  No
- Variable: ssl_capath   YesGlobalNo
ssl-cert Yes Yes  No
- Variable: ssl_cert   YesGlobalNo
ssl-cipher Yes Yes  No
- Variable: ssl_cipher   YesGlobalNo
ssl-key Yes Yes  No
- Variable: ssl_key   YesGlobalNo
storage_engine   YesBoth Yes
sync-bdb-logs Yes Yes YesGlobalNo
sync-binlog Yes Yes   Yes
- Variable: sync_binlog   YesGlobal Yes
sync-frm Yes Yes   Yes
- Variable: sync_frm   YesGlobal Yes
system_time_zone   YesGlobalNo
table_cache Yes Yes YesGlobal Yes
table_lock_wait_timeout Yes Yes YesGlobal Yes
table_open_cache  Yes YesGlobal Yes
table_type   YesBoth Yes
thread_cache_size Yes Yes YesGlobal Yes
thread_concurrency Yes Yes YesGlobalNo
thread_stack Yes Yes YesGlobalNo
timed_mutexes Yes Yes YesGlobal Yes
time_format Yes Yes YesBoth Yes
timestamp   YesSession Yes
time_zone Yes  YesBoth Yes
tmpdir Yes Yes YesGlobalNo
tmp_table_size Yes Yes YesBoth Yes
transaction_alloc_block_size Yes Yes YesBoth Yes
transaction_prealloc_size Yes Yes YesBoth Yes
tx_isolation   YesBoth Yes
unique_checks   YesSession Yes
updatable_views_with_limit Yes Yes YesBoth Yes
version Yes  YesGlobalNo
version_comment   YesGlobalNo
version_compile_machine   YesGlobalNo
version_compile_os   YesGlobalNo
wait_timeout Yes Yes YesBoth Yes
warning_count   YesSessionNo

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.

  • auto_increment_increment

    Version Introduced5.0.2
    Option Sets Variable Yes, auto_increment_increment
    Variable Nameauto_increment_increment
    Variable ScopeBoth
    Dynamic Variable Yes
    Value Set
    Typenumeric
    Default1
    Range1-65535

    auto_increment_increment and auto_increment_offset are intended for use with master-to-master replication, and can be used to control the operation of AUTO_INCREMENT columns. Both variables have global and session values, and each can assume an integer value between 1 and 65,535 inclusive. Setting the value of either of these two variables to 0 causes its value to be set to 1 instead. Attempting to set the value of either of these two variables to an integer greater than 65,535 or less than 0 causes its value to be set to 65,535 instead. Attempting to set the value of auto_increment_increment or auto_increment_offset to a non-integer value gives rise to an error, and the actual value of the variable remains unchanged.

    These two variables affect AUTO_INCREMENT column behavior as follows:

    • auto_increment_increment controls the interval between successive column values. For example:

      mysql> SHOW VARIABLES LIKE 'auto_inc%';
      +--------------------------+-------+
      | Variable_name            | Value |
      +--------------------------+-------+
      | auto_increment_increment | 1     |
      | auto_increment_offset    | 1     |
      +--------------------------+-------+
      2 rows in set (0.00 sec)
      
      mysql> CREATE TABLE autoinc1
          -> (col INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
        Query OK, 0 rows affected (0.04 sec)
      
      mysql> SET @@auto_increment_increment=10;
      Query OK, 0 rows affected (0.00 sec)
      
      mysql> SHOW VARIABLES LIKE 'auto_inc%';
      +--------------------------+-------+
      | Variable_name            | Value |
      +--------------------------+-------+
      | auto_increment_increment | 10    |
      | auto_increment_offset    | 1     |
      +--------------------------+-------+
      2 rows in set (0.01 sec)
      
      mysql> INSERT INTO autoinc1 VALUES (NULL), (NULL), (NULL), (NULL);
      Query OK, 4 rows affected (0.00 sec)
      Records: 4  Duplicates: 0  Warnings: 0
      
      mysql> SELECT col FROM autoinc1;
      +-----+
      | col |
      +-----+
      |   1 |
      |  11 |
      |  21 |
      |  31 |
      +-----+
      4 rows in set (0.00 sec)
      

      (Note how SHOW VARIABLES is used here to obtain the current values for these variables.)

    • auto_increment_offset determines the starting point for the AUTO_INCREMENT column value. Consider the following, assuming that these statements are executed during the same session as the example given in the description for auto_increment_increment:

      mysql> SET @@auto_increment_offset=5;
      Query OK, 0 rows affected (0.00 sec)
      
      mysql> SHOW VARIABLES LIKE 'auto_inc%';
      +--------------------------+-------+
      | Variable_name            | Value |
      +--------------------------+-------+
      | auto_increment_increment | 10    |
      | auto_increment_offset    | 5     |
      +--------------------------+-------+
      2 rows in set (0.00 sec)
      
      mysql> CREATE TABLE autoinc2
          -> (col INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
      Query OK, 0 rows affected (0.06 sec)
      
      mysql> INSERT INTO autoinc2 VALUES (NULL), (NULL), (NULL), (NULL);
      Query OK, 4 rows affected (0.00 sec)
      Records: 4  Duplicates: 0  Warnings: 0
      
      mysql> SELECT col FROM autoinc2;
      +-----+
      | col |
      +-----+
      |   5 |
      |  15 |
      |  25 |
      |  35 |
      +-----+
      4 rows in set (0.02 sec)
      

      If the value of auto_increment_offset is greater than that of auto_increment_increment, the value of auto_increment_offset is ignored.

    Should one or both of these variables be changed and then new rows inserted into a table containing an AUTO_INCREMENT column, the results may seem counterintuitive because the series of AUTO_INCREMENT values is calculated without regard to any values already present in the column, and the next value inserted is the least value in the series that is greater than the maximum existing value in the AUTO_INCREMENT column. In other words, the series is calculated like so:

    auto_increment_offset + N × auto_increment_increment

    where N is a positive integer value in the series [1, 2, 3, ...]. For example:

    mysql> SHOW VARIABLES LIKE 'auto_inc%';
    +--------------------------+-------+
    | Variable_name            | Value |
    +--------------------------+-------+
    | auto_increment_increment | 10    |
    | auto_increment_offset    | 5     |
    +--------------------------+-------+
    2 rows in set (0.00 sec)
    
    mysql> SELECT col FROM autoinc1;
    +-----+
    | col |
    +-----+
    |   1 |
    |  11 |
    |  21 |
    |  31 |
    +-----+
    4 rows in set (0.00 sec)
    
    mysql> INSERT INTO autoinc1 VALUES (NULL), (NULL), (NULL), (NULL);
    Query OK, 4 rows affected (0.00 sec)
    Records: 4  Duplicates: 0  Warnings: 0
    
    mysql> SELECT col FROM autoinc1;
    +-----+
    | col |
    +-----+
    |   1 |
    |  11 |
    |  21 |
    |  31 |
    |  35 |
    |  45 |
    |  55 |
    |  65 |
    +-----+
    8 rows in set (0.00 sec)
    

    The values shown for auto_increment_increment and auto_increment_offset generate the series 5 + N × 10, that is, [5, 15, 25, 35, 45, ...]. The greatest value present in the col column prior to the INSERT is 31, and the next available value in the AUTO_INCREMENT series is 35, so the inserted values for col begin at that point and the results are as shown for the SELECT query.

    It is not possible to confine the effects of these two variables to a single table, and thus they do not take the place of the sequences offered by some other database management systems; these variables control the behavior of all AUTO_INCREMENT columns in all tables on the MySQL server. If the global value of either variable is set, its effects persist until the global value is changed or overridden by setting the session value, or until mysqld is restarted. If the local value is set, the new value affects AUTO_INCREMENT columns for all tables into which new rows are inserted by the current user for the duration of the session, unless the values are changed during that session.

    The auto_increment_increment variable was added in MySQL 5.0.2. Its default value is 1. See Section 18.3.1.1, “Replication and AUTO_INCREMENT.

    auto_increment_increment is supported for use with NDB tables beginning with MySQL 5.0.46. Previously, setting it when using MySQL Cluster tables produced unpredictable results.

  • auto_increment_offset

    Version Introduced5.0.2
    Option Sets Variable Yes, auto_increment_offset
    Variable Nameauto_increment_offset
    Variable ScopeBoth
    Dynamic Variable Yes
    Value Set
    Typenumeric
    Default1
    Range1-65535

    This variable was introduced in MySQL 5.0.2. Its default value is 1. For particulars, see the description for auto_increment_increment.

    auto_increment_offset is supported for use with NDB tables beginning with MySQL 5.0.46. Previously, setting it when using MySQL Cluster tables produced unpredictable results.

  • automatic_sp_privileges

    Version Introduced5.0.3
    Variable Nameautomatic_sp_privileges
    Variable ScopeGlobal
    Dynamic Variable Yes
    Value Set
    Typeboolean
    DefaultTRUE

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

  • back_log

    Option Sets Variable Yes, back_log
    Variable Nameback_log
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typenumeric
    Default50
    Range1-65535

    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

    Option Sets Variable Yes, basedir
    Variable Namebasedir
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typefilename

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

  • bdb_cache_size

    Command Line Format--bdb_cache_size=#
    Config File Formatbdb_cache_size
    Option Sets Variable Yes, bdb_cache_size
    Variable Namebdb_cache_size
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typenumeric
    Min Value20480

    The size of the buffer that is allocated for caching indexes and rows for BDB tables. If you don't use BDB tables, you should start mysqld with --skip-bdb to not allocate memory for this cache.

  • bdb_home

    Command Line Format--bdb-home=name
    Variable Namebdb_home
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typefilename

    The base directory for BDB tables. This should be assigned the same value as the datadir variable.

  • bdb_log_buffer_size

    Command Line Format--bdb_log_buffer_size=#
    Config File Formatbdb_log_buffer_size
    Option Sets Variable Yes, bdb_log_buffer_size
    Variable Namebdb_log_buffer_size
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typenumeric
    Range262144-4294967295

    The size of the buffer that is allocated for caching indexes and rows for BDB tables. If you don't use BDB tables, you should set this to 0 or start mysqld with --skip-bdb to not allocate memory for this cache.

  • bdb_logdir

    Command Line Format--bdb-logdir=file_name
    Variable Namebdb_logdir
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typefilename

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

  • bdb_max_lock

    Command Line Format--bdb_max_lock=#
    Config File Formatbdb_max_lock
    Option Sets Variable Yes, bdb_max_lock
    Variable Namebdb_max_lock
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typenumeric
    Default10000

    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 ...
    
  • bdb_shared_data

    Command Line Format--bdb-shared-data
    Option Sets Variable Yes, bdb_shared_data
    Variable Namebdb_shared_data
    Variable ScopeGlobal
    Dynamic VariableNo

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

  • bdb_tmpdir

    Command Line Format--bdb-tmpdir=name
    Config File Formatbdb-tmpdir
    Variable Namebdb_tmpdir
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typefilename

    The BDB temporary file directory.

  • binlog_cache_size

    Option Sets Variable Yes, binlog_cache_size
    Variable Namebinlog_cache_size
    Variable ScopeGlobal
    Dynamic Variable Yes
    Value Set
    Typenumeric
    Default32768
    Range4096-4294967295

    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 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. See Section 5.2.3, “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

    Option Sets Variable Yes, bulk_insert_buffer_size
    Variable Namebulk_insert_buffer_size
    Variable ScopeBoth
    Dynamic Variable Yes
    Value Set
    Typenumeric
    Default8388608
    Range0-4294967295

    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 non-empty 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.

  • character_set_client

    Variable Namecharacter_set_client
    Variable ScopeBoth
    Dynamic Variable Yes
    Value Set
    Typestring

    The character set for statements that arrive from the client. The session value of this variable is set using the character set requested by the client when the client connects to the server. (Many clients support a --default-character-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

    Variable Namecharacter_set_connection
    Variable ScopeBoth
    Dynamic Variable Yes
    Value Set
    Typestring

    The character set used for literals that do not have a character set introducer and for number-to-string conversion.

  • character_set_database

    Variable Namecharacter_set_database
    Variable ScopeBoth
    Dynamic Variable Yes
    Value Set
    Typestring

    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.

  • character_set_filesystem

    Version Introduced5.0.19
    Option Sets Variable Yes, character_set_filesystem
    Variable Namecharacter_set_filesystem
    Variable ScopeBoth
    Dynamic Variable Yes
    Value Set
    Typestring

    The filesystem character set. This variable is used to interpret string literals that refer to filenames, such as in the LOAD DATA INFILE and SELECT ... INTO OUTFILE statements and the LOAD_FILE() function. Such filenames are converted from character_set_client to character_set_filesystem before the file opening attempt occurs. The default value is binary, which means that no conversion occurs. For systems on which multi-byte filenames are allowed, a different value may be more appropriate. For example, if the system represents filenames using UTF-8, set character_set_filesystem to 'utf8'. This variable was added in MySQL 5.0.19.

  • character_set_results

    Variable Namecharacter_set_results
    Variable ScopeBoth
    Dynamic Variable Yes
    Value Set
    Typestring

    The character set used for returning query results to the client.

  • character_set_server

    Option Sets Variable Yes, character_set_server
    Variable Namecharacter_set_server
    Variable ScopeBoth
    Dynamic Variable Yes
    Value Set
    Typestring

    The server's default character set.

  • character_set_system

    Variable Namecharacter_set_system
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typestring

    The character set used by the server for storing identifiers. The value is always utf8.

  • character_sets_dir

    Option Sets Variable Yes, character_sets_dir
    Variable Namecharacter-sets-dir
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typefilename

    The directory where character sets are installed.

  • collation_connection

    Variable Namecollation_connection
    Variable ScopeBoth
    Dynamic Variable Yes
    Value Set
    Typestring

    The collation of the connection character set.

  • collation_database

    Variable Namecollation_database
    Variable ScopeBoth
    Dynamic Variable Yes
    Value Set
    Typestring

    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.

  • collation_server

    Option Sets Variable Yes, collation_server
    Variable Namecollation_server
    Variable ScopeBoth
    Dynamic Variable Yes
    Value Set
    Typestring

    The server's default collation.

  • completion_type

    Version Introduced5.0.3
    Option Sets Variable Yes, completion_type
    Variable Namecompetion_type
    Variable ScopeBoth
    Dynamic Variable Yes
    Value Set
    Typenumeric
    Default0
    Valid Values0, 1, 2

    The transaction completion type:

    • If the value is 0 (the default), COMMIT and ROLLBACK are unaffected.

    • If the value is 1, COMMIT and ROLLBACK are equivalent to COMMIT AND CHAIN and ROLLBACK AND CHAIN, respectively. (A new transaction starts immediately with the same isolation level as the just-terminated transaction.)

    • If the value is 2, COMMIT and ROLLBACK are equivalent to COMMIT RELEASE and ROLLBACK RELEASE, respectively. (The server disconnects after terminating the transaction.)

    This variable was added in MySQL 5.0.3

  • concurrent_insert

    Option Sets Variable Yes, concurrent_insert
    Variable Nameconcurrent_insert
    Variable ScopeGlobal
    Dynamic Variable Yes
    Value Set (<= 5.0.6)
    Typeboolean
    DefaultTRUE
    Value Set (>= 5.0.6)
    Typenumeric
    Default1
    Valid Values0, 1, 2

    If 1 (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 or --skip-new.

    In MySQL 5.0.6, this variable was changed to take three integer values:

    ValueDescription
    0Off
    1(Default) Enables concurrent insert for MyISAM tables that don't have holes
    2Enables concurrent inserts for all MyISAM tables, even those that have holes. For a table with a hole, new rows are inserted at the end of the table if it is in use by another thread. Otherwise, MySQL acquires a normal write lock and inserts the row into the hole.

    See also Section 7.3.3, “Concurrent Inserts”.

  • connect_timeout

    Option Sets Variable Yes, connect_timeout
    Variable Nameconnect_timeout
    Variable ScopeGlobal
    Dynamic Variable Yes
    Value Set (<= 5.0.52)
    Typenumeric
    Default5
    Min Value2
    Value Set (>= 5.0.52)
    Typenumeric
    Default10

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

    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.

  • datadir

    Option Sets Variable Yes, datadir
    Variable Namedatadir
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typefilename

    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

    Option Sets Variable Yes, default_week_format
    Variable Namedefault_week_format
    Variable ScopeBoth
    Dynamic Variable Yes
    Value Set
    Typenumeric
    Default0
    Range0-7

    The default mode value to use for the WEEK() function. See Section 11.6, “Date and Time Functions”.

  • delay_key_write

    Option Sets Variable Yes, delay_key_write
    Variable Namedelay-key-write
    Variable ScopeGlobal
    Dynamic Variable Yes
    Value Set
    Typeenumeration
    DefaultON
    Valid ValuesON, OFF, ALL

    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, “Command Options”, and Section 13.1.1, “MyISAM Startup Options”.

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

  • delayed_insert_limit

    Option Sets Variable Yes, delayed_insert_limit
    Variable Namedelayed_insert_limit
    Variable ScopeGlobal
    Dynamic Variable Yes
    Value Set
    Typenumeric
    Default100
    Range1-4294967295

    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

    Option Sets Variable Yes, delayed_insert_timeout
    Variable Namedelayed_insert_timeout
    Variable ScopeGlobal
    Dynamic Variable Yes
    Value Set
    Typenumeric
    Default300

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

  • delayed_queue_size

    Option Sets Variable Yes, delayed_queue_size
    Variable Namedelayed_queue_size
    Variable ScopeGlobal
    Dynamic Variable Yes
    Value Set
    Typenumeric
    Default1000
    Range1-4294967295

    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.

  • div_precision_increment

    Version Introduced5.0.6
    Option Sets Variable Yes, div_precision_increment
    Variable Namediv_precision_increment
    Variable ScopeBoth
    Dynamic Variable Yes
    Value Set
    Typenumeric
    Default4
    Range0-30

    This variable indicates the number of digits by which to increase the scale of the result of division operations performed with the / operator. The default value is 4. The minimum and maximum values are 0 and 30, respectively. The following example illustrates the effect of increasing the default value.

    mysql> SELECT 1/7;
    +--------+
    | 1/7    |
    +--------+
    | 0.1429 |
    +--------+
    mysql> SET div_precision_increment = 12;
    mysql> SELECT 1/7;
    +----------------+
    | 1/7            |
    +----------------+
    | 0.142857142857 |
    +----------------+
    

    This variable was added in MySQL 5.0.6.

  • expire_logs_days

    Option Sets Variable Yes, expire_logs_days
    Variable Nameexpire_logs_days
    Variable ScopeGlobal
    Dynamic Variable Yes
    Value Set
    Typenumeric
    Default0
    Range0-99

    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.

  • flush

    Variable Nameflush
    Variable ScopeGlobal
    Dynamic Variable Yes
    Value Set
    Typeboolean
    DefaultOFF

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

  • flush_time

    Option Sets Variable Yes, flush_time
    Variable Nameflush_time
    Variable ScopeGlobal
    Dynamic Variable Yes
    Value Set
    Typelinuxnumeric
    Default0 
    Min Value0 
    Value Set
    Typemacosxnumeric
    Default0 
    Min Value0 
    Value Set
    Typehpuxnumeric
    Default0 
    Min Value0 
    Value Set
    Typesolarisnumeric
    Default0 
    Min Value0 
    Value Set
    Typenetwarenumeric
    Default0 
    Min Value0 
    Value Set
    Typewindowsnumeric
    Default1800 
    Min Value0 

    If this is set to a non-zero value, all tables are closed every flush_time seconds to free up resources and synchronize unflushed data to disk. We recommend that this option be used only on systems with minimal resources.

  • ft_boolean_syntax

    Variable Nameft_boolean_syntax
    Variable ScopeGlobal
    Dynamic Variable Yes
    Value Set
    Typestring
    Default+-><()~*:""&

    The list of operators supported by boolean full-text searches performed using IN BOOLEAN MODE. See Section 11.8.2, “Boolean Full-Text Searches”.

    The default variable value is '+ -><()~*:""&|'. The rules for changing the value are as follows:

    • Operator function is determined by position within the string.

    • The replacement value must be 14 characters.

    • Each character must be an ASCII non-alphanumeric 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

    Option Sets Variable Yes, ft_max_word_len
    Variable Nameft_max_word_len
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typenumeric
    Min Value10

    The maximum length of the word to be included in a FULLTEXT index.

    Note

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

  • ft_min_word_len

    Option Sets Variable Yes, ft_min_word_len
    Variable Nameft_min_word_len
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typenumeric
    Default4
    Min Value1

    The minimum length of the word to be included in a FULLTEXT index.

    Note

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

  • ft_query_expansion_limit

    Option Sets Variable Yes, ft_query_expansion_limit
    Variable Nameft_query_expansion_limit
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typenumeric
    Default20
    Range0-1000

    The number of top matches to use for full-text searches performed using WITH QUERY EXPANSION.

  • ft_stopword_file

    Option Sets Variable Yes, ft_stopword_file
    Variable Nameft_stopword_file
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typefilename

    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.

    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

    Option Sets Variable Yes, group_concat_max_len
    Variable Namegroup_concat_max_len
    Variable ScopeBoth
    Dynamic Variable Yes
    Value Set
    Typenumeric
    Default1024
    Min Value4

    The maximum allowed result length in bytes for the GROUP_CONCAT() function. The default is 1024.

  • have_archive

    YES if mysqld supports ARCHIVE tables, NO if not.

  • have_bdb

    YES if mysqld supports BDB tables. DISABLED if --skip-bdb is used.

  • have_blackhole_engine

    YES if mysqld supports BLACKHOLE tables, NO if not.

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

  • have_crypt

    YES if the crypt() system call is available to the server, NO if not. If not, the ENCRYPT() function cannot be used.

  • have_csv

    YES if mysqld supports CSV tables, NO if not.

  • have_example_engine

    YES if mysqld supports EXAMPLE tables, NO if not.

  • have_federated_engine

    YES if mysqld supports FEDERATED tables, NO if not. This variable was added in MySQL 5.0.3.

  • have_geometry

    YES if the server supports spatial data types, NO if not.

  • have_innodb

    YES if mysqld supports InnoDB tables. DISABLED if --skip-innodb is used.

  • have_isam

    In MySQL 5.0, this variable appears only for reasons of backward compatibility. It is always NO because ISAM tables are no longer supported.

  • have_merge_engine

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

  • have_openssl

    YES if mysqld supports SSL connections, NO if not. As of MySQL 5.0.38, this variable is an alias for have_ssl.

  • have_query_cache

    YES if mysqld supports the query cache, NO if not.

  • have_raid

    In MySQL 5.0, this variable appears only for reasons of backward compatibility. It is always NO because RAID tables are no longer supported.

  • have_rtree_keys

    YES if RTREE indexes are available, NO if not. (These are used for spatial indexes in MyISAM tables.)

  • have_ssl

    YES if mysqld supports SSL connections, NO if not. This variable was added in MySQL 5.0.38. Before that, use have_openssl.

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

  • hostname

    Version Introduced5.0.38
    Variable Namehostname
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typestring

    The server sets this variable to the server hostname at startup. This variable was added in MySQL 5.0.38.

  • init_connect

    Option Sets Variable Yes, init_connect
    Variable Nameinit_connect
    Variable ScopeGlobal
    Dynamic Variable Yes
    Value Set
    Typestring

    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.

  • init_file

    Option Sets Variable Yes, init_file
    Variable Nameinit_file
    Variable ScopeGlobal
    Dynamic VariableNo
    Value Set
    Typefilename

    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.

    Note that the --init-file option is unavailable if MySQL was configured with the --disable-grant-options option. See Section 2.4.15.2, “Typical configure Options”.

  • init_slave

    Option Sets Variable Yes, init_slave
    Variable Nameinit_slave
    Variable ScopeGlobal
    Dynamic Variable Yes
    Value Set
    Typestring

    This variable is similar to init_connect, but is a string to be executed by a slave server each time the SQL thread starts. The format of the string is the same as for the init_connect variable.

    Note

    The SQL thread sends an acknowledgement to the client before init_slave is executed. Therefore, it is not guaranteed that init_slave has been executed when START SLAVE returns. See Section 12.6.2.7, “START SLAVE Syntax”, for more information.

  • innodb_xxx

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

  • interactive_timeout

    Option Sets Variable Yes, interactive_timeout
    Variable Nameinteractive_timeout
    Variable ScopeBoth
    Dynamic Variable Yes
    Value Set
    Typenumeric
    Default28800
    Min Value1

    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

    Option Sets Variable Yes, join_buffer_size
    Variable Namejoin_buffer_size
    Variable ScopeBoth
    Dynamic Variable Yes
    Value Set
    Typenumeric
    Default131072
    Range8200-4294967295

    The size of the buffer that is used for 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.

    The maximum allowable setting for join_buffer_size is 4GB.

  • keep_files_on_create

    Version Introduced5.0.48
    Option Sets Variable Yes, keep_files_on_create
    Variable Namekeep_files_on_create
    Variable ScopeBoth
    Dynamic Variable Yes
    Value Set
    Typeboolean
    DefaultOFF

    If a MyISAM table is created with no DATA DIRECTORY option, the .MYD file is created in the database directory. By default, if MyISAM finds an existing .MYD file in this case, it overwrites it. The same applies to .MYI files for tables created with no INDEX DIRECTORY option. To suppress this behavior, set the keep_files_on_create variable to ON (1), in which case MyISAM will not overwrite existing files and returns an error instead. The default value is OFF (0).

    If a MyISAM table is created with a DATA DIRECTORY or INDEX DIRECTORY option and an existing .MYD or .MYI file is found, MyISAM always returns an error. It will not overwrite a file in the specified directory.

    This variable was added in MySQL 5.0.48.

  • key_buffer_size

    Option Sets Variable Yes, key_buffer_size
    Variable Namekey_buffer_size
    Variable ScopeGlobal
    Dynamic Variable Yes
    Value Set
    Typenumeric
    Default8388608
    Range8-4294967295

    Index blocks for MyISAM 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 on 32-bit platforms. As of MySQL 5.0.52, values larger than 4GB are allowed for 64-bit platforms (except 64-bit Windows, for which large values are truncated to 4GB with a warning). 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 filesy