Chapter 5. MySQL Server Administration
Table of Contents
- 5.1. The MySQL Server
- 5.2. The mysqld-max Extended MySQL Server
- 5.3. MySQL Server Logs
- 5.4. General Security Issues
- 5.5. The MySQL Access Privilege System
- 5.6. MySQL User Account Management
- 5.6.1. User Names and Passwords
- 5.6.2. Adding User Accounts
- 5.6.3. Removing User Accounts
- 5.6.4. Limiting Account Resources
- 5.6.5. Assigning Account Passwords
- 5.6.6. Password Security in MySQL
- 5.6.7. Using SSL for Secure Connections
- 5.6.8. Connecting to MySQL Remotely from Windows with SSH
- 5.6.9. Auditing MySQL Account Activity
- 5.7. Running Multiple MySQL Servers on the Same Machine
End of Product LifecycleActive development and support for MySQL database server versions 3.23, 4.0, and 4.1 has ended. However, for MySQL 4.0 and 4.1, there is still extended support available. For details, see http://www.mysql.com/company/legal/lifecycle/#calendar. According to the MySQL Lifecycle Policy (see http://www.mysql.com/company/legal/lifecycle/#policy), only Security and Severity Level 1 issues will still be fixed for MySQL 4.0 and 4.1. Please consider upgrading to a recent version (MySQL 5.0 or 5.1).
MySQL Server (mysqld) is the main program that does most of the work in a MySQL installation. This section provides an overview of MySQL Server and covers topics that deal with administering a MySQL installation:
Server configuration
The server log files
Security issues and user-account management
Management of multiple servers on a single machine
mysqld is the MySQL server. The following discussion covers these MySQL server configuration topics:
Startup options that the server supports
Server system variables
Server status variables
How to set the server SQL mode
The server shutdown process
Note
Not all storage engines (also known in older versions of MySQL as
“table types”) are supported by all MySQL server
binaries and configurations. To find out how to determine which
storage engines are supported by your MySQL server installation,
see Section 12.5.5.10, “SHOW ENGINES Syntax”.
The following table provides a list of all the command line
options, server and status variables applicable within
mysqld.
The table lists command-line options (Cmd-line), options valid in configuration files (Option file), server system variables (System Var), and status variables (Status var) in one unified list, with notification of where each option/variable is valid. If a server option set on the command line or in an option file differs from the name of the corresponding server system or status variable, the variable name is noted immediately below the corresponding option. For status variables, the scope of the variable is shown (Scope) as either global, session, or both. Please see the corresponding sections for details on setting and using the options and variables. Where appropriate, a direct link to further information on the item as available.
Table 5.1. mysqld Option/Variable Summary
| Name | Cmd-Line | Option file | System Var | Status Var | Var Scope | Dynamic |
|---|---|---|---|---|---|---|
| abort-slave-event-count | Yes | Yes | ||||
| Aborted_clients | Yes | Global | No | |||
| Aborted_connects | Yes | Global | No | |||
| allow-suspicious-udfs | Yes | Yes | ||||
| ansi | Yes | Yes | ||||
| autocommit | Yes | Session | Yes | |||
| back_log | Yes | Yes | Yes | Global | No | |
| basedir | Yes | Yes | Yes | Global | No | |
| bdb_cache_size | Yes | Yes | Yes | Global | No | |
| bdb-home | Yes | Yes | Global | No | ||
| - Variable: bdb_home | Yes | Global | No | |||
| bdb-lock-detect | Yes | Yes | Global | No | ||
| - Variable: bdb_lock_detect | Yes | Global | No | |||
| bdb_log_buffer_size | Yes | Yes | Yes | Global | No | |
| bdb-logdir | Yes | Yes | Global | No | ||
| - Variable: bdb_logdir | Yes | Global | No | |||
| bdb_max_lock | Yes | Yes | Yes | Global | No | |
| bdb-no-recover | Yes | Yes | ||||
| bdb-no-sync | Yes | Yes | ||||
| bdb-shared-data | Yes | Yes | Global | No | ||
| - Variable: bdb_shared_data | Yes | Global | No | |||
| bdb-tmpdir | Yes | Yes | Global | No | ||
| - Variable: bdb_tmpdir | Yes | Global | No | |||
| big-tables | Yes | Yes | Session | Yes | ||
| - Variable: big_tables | Yes | Session | Yes | |||
| bind-address | Yes | Yes | ||||
| Binlog_cache_disk_use | Yes | Global | No | |||
| binlog_cache_size | Yes | Yes | Yes | Global | Yes | |
| Binlog_cache_use | Yes | Global | No | |||
| binlog-do-db | Yes | Yes | ||||
| binlog-ignore-db | Yes | Yes | ||||
| bootstrap | Yes | Yes | ||||
| bulk_insert_buffer_size | Yes | Yes | Yes | Both | Yes | |
| Bytes_received | Yes | Both | No | |||
| Bytes_sent | Yes | Both | No | |||
| character_set | Yes | Yes | No | |||
| character_set_client | Yes | Both | Yes | |||
| character-set-client-handshake | Yes | Yes | ||||
| character_set_connection | Yes | Both | Yes | |||
| character_set_database[a] | Yes | Both | Yes | |||
| character_set_results | Yes | Both | Yes | |||
| character-set-server | Yes | Yes | Both | Yes | ||
| - Variable: character_set_server | Yes | Both | Yes | |||
| character_set_system | Yes | Global | No | |||
| character-sets-dir | Yes | Yes | Global | No | ||
| - Variable: character_sets_dir | Yes | Global | No | |||
| chroot | Yes | Yes | ||||
| collation_connection | Yes | Both | Yes | |||
| collation_database[b] | Yes | Both | Yes | |||
| collation-server | Yes | Yes | Both | Yes | ||
| - Variable: collation_server | Yes | Both | Yes | |||
| Com_admin_commands | Yes | Both | No | |||
| Com_alter_db | Yes | Both | No | |||
| Com_alter_table | Yes | Both | No | |||
| Com_analyze | Yes | Both | No | |||
| Com_backup_table | Yes | Both | No | |||
| Com_begin | Yes | Both | No | |||
| Com_change_db | Yes | Both | No | |||
| Com_change_master | Yes | Both | No | |||
| Com_check | Yes | Both | No | |||
| Com_checksum | Yes | Both | No | |||
| Com_commit | Yes | Both | No | |||
| Com_create_db | Yes | Both | No | |||
| Com_create_index | Yes | Both | No | |||
| Com_create_table | Yes | Both | No | |||
| Com_dealloc_sql | Yes | Both | No | |||
| Com_delete | Yes | Both | No | |||
| Com_delete_multi | Yes | Both | No | |||
| Com_do | Yes | Both | No | |||
| Com_drop_db | Yes | Both | No | |||
| Com_drop_index | Yes | Both | No | |||
| Com_drop_table | Yes | Both | No | |||
| Com_drop_user | Yes | Both | No | |||
| Com_execute_sql | Yes | Both | No | |||
| Com_flush | Yes | Both | No | |||
| Com_grant | Yes | Both | No | |||
| Com_ha_close | Yes | Both | No | |||
| Com_ha_open | Yes | Both | No | |||
| Com_ha_read | Yes | Both | No | |||
| Com_help | Yes | Both | No | |||
| Com_insert | Yes | Both | No | |||
| Com_insert_select | Yes | Both | No | |||
| Com_kill | Yes | Both | No | |||
| Com_load | Yes | Both | No | |||
| Com_load_master_data | Yes | Both | No | |||
| Com_load_master_table | Yes | Both | No | |||
| Com_lock_tables | Yes | Both | No | |||
| Com_optimize | Yes | Both | No | |||
| Com_preload_keys | Yes | Both | No | |||
| Com_prepare_sql | Yes | Both | No | |||
| Com_rename_table | Yes | Both | No | |||
| Com_repair | Yes | Both | No | |||
| Com_replace | Yes | Both | No | |||
| Com_replace_select | Yes | Both | No | |||
| Com_reset | Yes | Both | No | |||
| Com_restore_table | Yes | Both | No | |||
| Com_revoke | Yes | Both | No | |||
| Com_revoke_all | Yes | Both | No | |||
| Com_rollback | Yes | Both | No | |||
| Com_savepoint | Yes | Both | No | |||
| Com_select | Yes | Both | No | |||
| Com_set_option | Yes | Both | No | |||
| Com_show_binlog_events | Yes | Both | No | |||
| Com_show_binlogs | Yes | Both | No | |||
| Com_show_charsets | Yes | Both | No | |||
| Com_show_collations | Yes | Both | No | |||
| Com_show_column_types | Yes | Both | No | |||
| Com_show_create_db | Yes | Both | No | |||
| Com_show_create_event | Yes | Both | No | |||
| Com_show_create_table | Yes | Both | No | |||
| Com_show_databases | Yes | Both | No | |||
| Com_show_engine_logs | Yes | Both | No | |||
| Com_show_engine_mutex | Yes | Both | No | |||
| Com_show_engine_status | Yes | Both | No | |||
| Com_show_errors | Yes | Both | No | |||
| Com_show_fields | Yes | Both | No | |||
| Com_show_grants | Yes | Both | No | |||
| Com_show_innodb_status | Yes | Both | No | |||
| Com_show_keys | Yes | Both | No | |||
| Com_show_logs | Yes | Both | No | |||
| Com_show_master_status | Yes | Both | No | |||
| Com_show_ndb_status | Yes | Both | No | |||
| Com_show_new_master | Yes | Both | No | |||
| Com_show_open_tables | Yes | Both | No | |||
| Com_show_privileges | Yes | Both | No | |||
| Com_show_processlist | Yes | Both | No | |||
| Com_show_slave_hosts | Yes | Both | No | |||
| Com_show_slave_status | Yes | Both | No | |||
| Com_show_status | Yes | Both | No | |||
| Com_show_storage_engines | Yes | Both | No | |||
| Com_show_tables | Yes | Both | No | |||
| Com_show_variables | Yes | Both | No | |||
| Com_show_warnings | Yes | Both | No | |||
| Com_slave_start | Yes | Both | No | |||
| Com_slave_stop | Yes | Both | No | |||
| Com_stmt_close | Yes | Both | No | |||
| Com_stmt_execute | Yes | Both | No | |||
| Com_stmt_fetch | Yes | Both | No | |||
| Com_stmt_prepare | Yes | Both | No | |||
| Com_stmt_reset | Yes | Both | No | |||
| Com_stmt_send_long_data | Yes | Both | No | |||
| Com_truncate | Yes | Both | No | |||
| Com_unlock_tables | Yes | Both | No | |||
| Com_update | Yes | Both | No | |||
| Com_update_multi | Yes | Both | No | |||
| concurrent_insert | Yes | Yes | Yes | Global | Yes | |
| connect_timeout | Yes | Yes | Yes | Global | Yes | |
| console | Yes | Yes | ||||
| core-file | Yes | Yes | ||||
| crash_binlog_innodb | Yes | Yes | ||||
| Created_tmp_disk_tables | Yes | Both | No | |||
| Created_tmp_files | Yes | Global | No | |||
| Created_tmp_tables | Yes | Both | No | |||
| datadir | Yes | Yes | Yes | Global | No | |
| date_format | Yes | Both | Yes | |||
| datetime_format | Yes | Yes | Yes | Both | Yes | |
| debug | Yes | Yes | Yes | Both | Yes | |
| default-character-set | Yes | Yes | ||||
| default-collation | Yes | Yes | No | |||
| default-storage-engine | Yes | Yes | ||||
| default-table-type | Yes | Yes | ||||
| default-time-zone | Yes | Yes | ||||
| default_week_format | Yes | Yes | Yes | Both | Yes | |
| defaults-extra-file | Yes | |||||
| defaults-file | Yes | |||||
| delay-key-write | Yes | Yes | Global | Yes | ||
| - Variable: delay_key_write | Yes | Global | Yes | |||
| delayed_insert_limit | Yes | Yes | Yes | Global | Yes | |
| delayed_insert_timeout | Yes | Yes | Yes | Global | Yes | |
| delayed_queue_size | Yes | Yes | Yes | Global | Yes | |
| des-key-file | Yes | Yes | ||||
| disconnect-slave-event-count | Yes | Yes | ||||
| enable-locking | Yes | Yes | ||||
| enable-pstack | Yes | Yes | ||||
| error_count | Yes | Session | No | |||
| exit-info | Yes | Yes | ||||
| expire_logs_days | Yes | Yes | Yes | Global | Yes | |
| external-locking | Yes | Yes | ||||
| - Variable: skip_external_locking | ||||||
| flush | Yes | Yes | Yes | Global | Yes | |
| 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 | Global | No | |
| ft_min_word_len | Yes | Yes | Yes | Global | No | |
| ft_query_expansion_limit | Yes | Yes | Yes | Global | No | |
| ft_stopword_file | Yes | Yes | Yes | Global | No | |
| gdb | Yes | Yes | ||||
| group_concat_max_len | Yes | Yes | Yes | Both | Yes | |
| Handler_commit | Yes | Both | No | |||
| Handler_delete | Yes | Both | No | |||
| Handler_discover | Yes | Both | No | |||
| Handler_read_first | Yes | Both | No | |||
| Handler_read_key | Yes | Both | No | |||
| Handler_read_next | Yes | Both | No | |||
| Handler_read_prev | Yes | Both | No | |||
| Handler_read_rnd | Yes | Both | No | |||
| Handler_read_rnd_next | Yes | Both | No | |||
| Handler_rollback | Yes | Both | No | |||
| Handler_update | Yes | Both | No | |||
| Handler_write | Yes | Both | No | |||
| have_archive | Yes | Global | No | |||
| have_bdb | Yes | Global | No | |||
| have_blackhole_engine | Yes | Global | No | |||
| have_compress | Yes | Global | No | |||
| have_crypt | Yes | Global | No | |||
| have_csv | Yes | Global | No | |||
| have_example_engine | Yes | Global | No | |||
| have_geometry | Yes | Global | No | |||
| have_innodb | Yes | Global | No | |||
| have_isam | Yes | Global | No | |||
| have_merge_engine | Yes | Global | No | |||
| have_ndbcluster | Yes | Global | No | |||
| have_openssl | Yes | Global | No | |||
| have_query_cache | Yes | Global | No | |||
| have_raid | Yes | Global | No | |||
| have_rtree_keys | Yes | Global | No | |||
| have_symlink | Yes | Global | No | |||
| help | Yes | Yes | ||||
| identity | Yes | Session | Yes | |||
| init_connect | Yes | Yes | Yes | Global | Yes | |
| init-file | Yes | Yes | Global | No | ||
| - Variable: init_file | Yes | Global | No | |||
| init_slave | Yes | Yes | Yes | Global | Yes | |
| innodb | Yes | Yes | ||||
| innodb_additional_mem_pool_size | Yes | Yes | Yes | Global | No | |
| innodb_autoextend_increment | Yes | Yes | Yes | Global | Yes | |
| innodb_buffer_pool_awe_mem_mb | Yes | Yes | Yes | Global | No | |
| innodb_buffer_pool_size | Yes | Yes | Yes | Global | No | |
| innodb_data_file_path | Yes | Yes | Yes | Global | No | |
| innodb_data_home_dir | Yes | Yes | Yes | Global | No | |
| innodb_fast_shutdown | Yes | Yes | Yes | Global | Yes | |
| innodb_file_io_threads | Yes | Yes | Yes | Global | No | |
| innodb_file_per_table | Yes | Yes | Yes | Global | No | |
| innodb_flush_log_at_trx_commit | Yes | Yes | Yes | Global | Yes | |
| innodb_flush_method | Yes | Yes | Yes | Global | No | |
| innodb_force_recovery | Yes | Yes | Yes | Global | No | |
| innodb_lock_wait_timeout | Yes | Yes | Yes | Global | No | |
| innodb_locks_unsafe_for_binlog | Yes | Yes | Yes | Global | No | |
| innodb_log_arch_dir | Yes | Yes | Yes | Global | No | |
| innodb_log_archive | Yes | Yes | Yes | Global | No | |
| innodb_log_buffer_size | Yes | Yes | Yes | Global | No | |
| innodb_log_file_size | Yes | Yes | Yes | Global | No | |
| innodb_log_files_in_group | Yes | Yes | Yes | Global | No | |
| innodb_log_group_home_dir | Yes | Yes | Yes | Global | No | |
| 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 | Global | No | |
| innodb_open_files | Yes | Yes | Yes | Global | No | |
| innodb_safe_binlog | Yes | Yes | ||||
| innodb_status_file | Yes | Yes | ||||
| innodb_table_locks | Yes | Yes | Yes | Both | Yes | |
| innodb_thread_concurrency | Yes | Yes | Yes | Global | Yes | |
| insert_id | Yes | Session | Yes | |||
| interactive_timeout | Yes | Yes | Yes | Both | Yes | |
| isam | Yes | Yes | Yes | No | ||
| join_buffer_size | Yes | Yes | Yes | Both | Yes | |
| Key_blocks_not_flushed | Yes | Global | No | |||
| Key_blocks_unused | Yes | Global | No | |||
| Key_blocks_used | Yes | Global | No | |||
| 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 | Yes | Global | No | |||
| Key_reads | Yes | Global | No | |||
| Key_write_requests | Yes | Global | No | |||
| Key_writes | Yes | Global | No | |||
| language | Yes | Yes | Yes | Global | No | |
| last_insert_id | Yes | Session | Yes | |||
| lc_time_names | Yes | Both | Yes | |||
| license | Yes | Global | No | |||
| local_infile | Yes | Global | Yes | |||
| local-infile | Yes | Yes | ||||
| - Variable: local_infile | ||||||
| locked_in_memory | Yes | Global | No | |||
| log | Yes | Yes | Yes | Global | No | |
| log_bin | Yes | Global | No | |||
| log-bin | Yes | Yes | Yes | Global | No | |
| log-bin-index | Yes | Yes | ||||
| log-error | Yes | Yes | Global | No | ||
| - Variable: log_error | Yes | Global | No | |||
| log-isam | Yes | Yes | ||||
| log-long-format | 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 | Global | No | ||
| - Variable: log_slave_updates | Yes | Global | No | |||
| log-slow-admin-statements | Yes | Yes | ||||
| log-slow-queries | Yes | Yes | Global | No | ||
| - Variable: log_slow_queries | Yes | Global | No | |||
| log-update | Yes | |||||
| - Variable: log_update | ||||||
| log-warnings | Yes | Yes | Both | Yes | ||
| - Variable: log_warnings | Yes | Both | Yes | |||
| long_query_time | Yes | Yes | Yes | Both | Yes | |
| low-priority-updates | Yes | Yes | Both | Yes | ||
| - Variable: low_priority_updates | Yes | Both | Yes | |||
| lower_case_file_system | Yes | Yes | Yes | Global | No | |
| lower_case_table_names | Yes | Yes | Yes | Global | No | |
| 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_tmp_tables | Yes | Yes | Yes | Both | Yes | |
| Max_used_connections | Yes | Global | No | |||
| max_user_connections | Yes | Yes | Yes | Global | Yes | |
| max_write_lock_count | Yes | Yes | Yes | Global | Yes | |
| memlock | Yes | Yes | Yes | Global | No | |
| merge | Yes | Yes | ||||
| myisam-block-size | Yes | Yes | ||||
| myisam_data_pointer_size | Yes | Yes | Yes | Global | Yes | |
| myisam_max_extra_sort_file_size | Yes | Yes | Yes | Global | No | |
| myisam_max_sort_file_size | Yes | Yes | Yes | Global | Yes | |
| myisam-recover | Yes | Yes | ||||
| myisam_recover_options | Yes | Global | No | |||
| 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 | Global | No | |||
| ndb_autoincrement_prefetch_sz | Yes | Yes | Yes | Both | Yes | |
| ndb_cache_check_time | Yes | Yes | Yes | Global | Yes | |
| 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 | ||||
| ndbcluster | 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 | Yes | Global | No | |||
| old-passwords | Yes | Yes | Both | Yes | ||
| - Variable: old_passwords | Yes | Both | Yes | |||
| old-protocol | Yes | Yes | ||||
| Open_files | Yes | Global | No | |||
| open-files-limit | Yes | Yes | Global | No | ||
| - Variable: open_files_limit | Yes | Global | No | |||
| Open_streams | Yes | Global | No | |||
| Open_tables | Yes | Both | No | |||
| Opened_tables | Yes | Both | No | |||
| pid-file | Yes | Yes | Global | No | ||
| - Variable: pid_file | Yes | Global | No | |||
| plugin_dir | Yes | Yes | Yes | Global | No | |
| port | Yes | Yes | Yes | Global | No | |
| preload_buffer_size | Yes | Yes | Yes | Both | Yes | |
| Prepared_stmt_count | Yes | Global | No | |||
| prepared_stmt_count | Yes | Both | No | |||
| print-defaults | Yes | |||||
| protocol_version | Yes | Global | No | |||
| pseudo_thread_id | Yes | Both | Yes | |||
| Qcache_free_blocks | Yes | Global | No | |||
| Qcache_free_memory | Yes | Global | No | |||
| Qcache_hits | Yes | Global | No | |||
| Qcache_inserts | Yes | Global | No | |||
| Qcache_lowmem_prunes | Yes | Global | No | |||
| Qcache_not_cached | Yes | Global | No | |||
| Qcache_queries_in_cache | Yes | Global | No | |||
| Qcache_total_blocks | Yes | Global | No | |||
| 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 | Yes | Both | No | |||
| 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 | ||||
| - Variable: relay_log_index | ||||||
| relay-log-info-file | Yes | Yes | ||||
| - Variable: relay_log_info_file | ||||||
| relay_log_purge | Yes | Yes | Yes | Global | Yes | |
| relay_log_space_limit | Yes | Yes | Yes | Global | No | |
| 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 | Global | No | ||
| - Variable: report_host | Yes | Global | No | |||
| report-password | Yes | Yes | Global | No | ||
| - Variable: report_password | Yes | Global | No | |||
| report-port | Yes | Yes | Global | No | ||
| - Variable: report_port | Yes | Global | No | |||
| report-user | Yes | Yes | Global | No | ||
| - Variable: report_user | Yes | Global | No | |||
| rpl_recovery_rank | Yes | Global | Yes | |||
| safe-mode | Yes | Yes | ||||
| safe-show-database | Yes | Yes | Yes | Global | Yes | |
| safe-user-create | Yes | Yes | ||||
| safemalloc-mem-limit | Yes | Yes | ||||
| secure-auth | Yes | Yes | Global | Yes | ||
| - Variable: secure_auth | Yes | Global | Yes | |||
| Select_full_join | Yes | Both | No | |||
| Select_full_range_join | Yes | Both | No | |||
| Select_range | Yes | Both | No | |||
| Select_range_check | Yes | Both | No | |||
| Select_scan | Yes | Both | No | |||
| server-id | Yes | Yes | Global | Yes | ||
| - Variable: server_id | Yes | Global | Yes | |||
| set-variable | Yes | Yes | ||||
| shared_memory | Yes | Global | No | |||
| shared_memory_base_name | Yes | Global | No | |||
| 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 | Global | No | ||
| - Variable: skip_external_locking | Yes | Global | No | |||
| skip-grant-tables | Yes | Yes | ||||
| skip-host-cache | Yes | Yes | ||||
| skip-innodb | Yes | Yes | ||||
| skip-isam | Yes | Yes | Yes | No | ||
| skip-locking | Yes | Yes | ||||
| skip-log-warnings | Yes | |||||
| skip-name-resolve | Yes | Yes | ||||
| skip-networking | Yes | Yes | Global | No | ||
| - Variable: skip_networking | Yes | Global | No | |||
| skip-new | Yes | Yes | ||||
| skip-safemalloc | Yes | Yes | ||||
| skip-show-database | Yes | Yes | Global | No | ||
| - Variable: skip_show_database | Yes | Global | No | |||
| 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 | Global | No | |
| skip-thread-priority | Yes | Yes | ||||
| slave_compressed_protocol | Yes | Yes | Yes | Global | Yes | |
| slave-load-tmpdir | Yes | Yes | Global | No | ||
| - Variable: slave_load_tmpdir | Yes | Global | No | |||
| slave-net-timeout | Yes | Yes | Global | Yes | ||
| - Variable: slave_net_timeout | Yes | Global | Yes | |||
| Slave_open_temp_tables | Yes | Global | No | |||
| slave-skip-errors | Yes | Yes | Global | No | ||
| - Variable: slave_skip_errors | Yes | Global | No | |||
| slave_transaction_retries | Yes | Yes | Yes | Global | Yes | |
| Slow_launch_threads | Yes | Both | No | |||
| slow_launch_time | Yes | Yes | Yes | Global | Yes | |
| Slow_queries | Yes | Both | No | |||
| socket | Yes | Yes | Yes | Global | No | |
| sort_buffer_size | Yes | Yes | Yes | Both | Yes | |
| Sort_merge_passes | Yes | Both | No | |||
| Sort_range | Yes | Both | No | |||
| Sort_rows | Yes | Both | No | |||
| Sort_scan | Yes | Both | No | |||
| 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-bin-update-same | Yes | 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_accept_renegotiates | Yes | Global | No | |||
| Ssl_accepts | Yes | Global | No | |||
| ssl-ca | Yes | Yes | Global | No | ||
| - Variable: ssl_ca | Yes | Global | No | |||
| Ssl_callback_cache_hits | Yes | Global | No | |||
| ssl-capath | Yes | Yes | Global | No | ||
| - Variable: ssl_capath | Yes | Global | No | |||
| ssl-cert | Yes | Yes | Global | No | ||
| - Variable: ssl_cert | Yes | Global | No | |||
| ssl-cipher | Yes | Yes | Global | No | ||
| - Variable: ssl_cipher | Yes | Global | No | |||
| Ssl_cipher | Yes | Both | No | |||
| Ssl_cipher_list | Yes | Both | No | |||
| Ssl_client_connects | Yes | Global | No | |||
| Ssl_connect_renegotiates | Yes | Global | No | |||
| Ssl_ctx_verify_depth | Yes | Global | No | |||
| Ssl_ctx_verify_mode | Yes | Global | No | |||
| Ssl_default_timeout | Yes | Both | No | |||
| Ssl_finished_accepts | Yes | Global | No | |||
| Ssl_finished_connects | Yes | Global | No | |||
| ssl-key | Yes | Yes | Global | No | ||
| - Variable: ssl_key | Yes | Global | No | |||
| Ssl_session_cache_hits | Yes | Global | No | |||
| Ssl_session_cache_misses | Yes | Global | No | |||
| Ssl_session_cache_mode | Yes | Global | No | |||
| Ssl_session_cache_overflows | Yes | Global | No | |||
| Ssl_session_cache_size | Yes | Global | No | |||
| Ssl_session_cache_timeouts | Yes | Global | No | |||
| Ssl_sessions_reused | Yes | Both | No | |||
| Ssl_used_session_cache_entries | Yes | Global | No | |||
| Ssl_verify_depth | Yes | Both | No | |||
| Ssl_verify_mode | Yes | Both | No | |||
| Ssl_version | Yes | Both | No | |||
| standalone | Yes | Yes | ||||
| storage_engine | Yes | Both | Yes | |||
| symbolic-links | Yes | Yes | ||||
| sync-bdb-logs | Yes | Yes | Global | No | ||
| - Variable: sync_bdb_logs | Yes | Global | No | |||
| sync-binlog | Yes | Yes | Global | Yes | ||
| - Variable: sync_binlog | Yes | Global | Yes | |||
| sync-frm | Yes | Yes | Global | Yes | ||
| - Variable: sync_frm | Yes | Global | Yes | |||
| system_time_zone | Yes | Global | No | |||
| Table_locks_immediate | Yes | Global | No | |||
| Table_locks_waited | Yes | Global | No | |||
| table_type | Yes | Both | Yes | |||
| temp-pool | Yes | Yes | ||||
| thread_cache_size | Yes | Yes | Yes | Global | Yes | |
| thread_concurrency | Yes | Yes | Yes | Global | No | |
| thread_stack | Yes | Yes | Yes | Global | No | |
| Threads_cached | Yes | Global | No | |||
| Threads_connected | Yes | Global | No | |||
| Threads_created | Yes | Global | No | |||
| Threads_running | Yes | Global | No | |||
| time_format | Yes | Yes | Yes | Both | Yes | |
| time_zone | Yes | Yes | Yes | Both | Yes | |
| timestamp | Yes | Session | Yes | |||
| tmp_table_size | Yes | Yes | Yes | Both | Yes | |
| tmpdir | Yes | Yes | Yes | Global | No | |
| 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 | |||
| Uptime | Yes | Global | No | |||
| user | Yes | Yes | ||||
| verbose | Yes | Yes | ||||
| version | Yes | Yes | Yes | Global | No | |
| version_comment | Yes | Global | No | |||
| version_compile_machine | Yes | Global | No | |||
| version_compile_os | Yes | Global | No | |||
| wait_timeout | Yes | Yes | Yes | Both | Yes | |
| warning_count | Yes | Session | No | |||
| warnings | Yes | Yes | ||||
[a] This option is dynamic, but only the server should set this information. You should not set the value of this variable manually. [b] This option is dynamic, but only the server should set this information. You should not set the value of this variable manually. | ||||||
When you start the mysqld server, you can specify program options using any of the methods described in Section 4.2.3, “Specifying Program Options”. The most common methods are to provide options in an option file or on the command line. However, in most cases it is desirable to make sure that the server uses the same options each time it runs. The best way to ensure this is to list them in an option file. See Section 4.2.3.3, “Using Option Files”.
MySQL Enterprise For expert advice on setting command options, subscribe to the MySQL Enterprise Monitor. For more information, see http://www.mysql.com/products/enterprise/advisors.html.
mysqld reads options from the
[mysqld] and [server]
groups. mysqld_safe reads options from the
[mysqld], [server],
[mysqld_safe], and
[safe_mysqld] groups.
mysql.server reads options from the
[mysqld] and [mysql.server]
groups.
An embedded MySQL server usually reads options from the
[server], [embedded], and
[
groups, where xxxxx_SERVER]xxxxx is the name of the
application into which the server is embedded.
mysqld accepts many command options. For a
list, execute mysqld --help. Before MySQL
4.1.1, --help prints the full help
message. As of 4.1.1, it prints a brief message; to see the full
list, use mysqld --verbose --help.
The following list shows some of the most common server options. Additional options are described in other sections:
Options that affect security: See Section 5.4.3, “Security-Related mysqld Options”.
SSL-related options: See Section 5.6.7.3, “SSL Command Options”.
Binary log control options: See Section 14.8.4, “Binary Log Options and Variables”.
Replication-related options: See Section 14.8, “Replication and Binary Logging Options and Variables”.
Options specific to particular storage engines: See Section 13.1.1, “
MyISAMStartup Options”, Section 13.5.3, “BDBStartup Options”, Section 13.2.4, “InnoDBStartup Options and System Variables”, and Section 15.4.2, “mysqld Command Options for MySQL Cluster”.
You can also set the values of server system variables by using variable names as options, as described at the end of this section.
--help,-?Display a short help message and exit. Before MySQL 4.1.1,
--helpdisplays the full help message. As of 4.1.1, it displays an abbreviated message only. Use both the--verboseand--helpoptions to see the full message.This option controls whether user-defined functions that have only an
xxxsymbol for the main function can be loaded. By default, the option is off and only UDFs that have at least one auxiliary symbol can be loaded; this prevents attempts at loading functions from shared object files other than those containing legitimate UDFs. This option was added in MySQL 4.0.24, and 4.1.10a. See Section 18.2.2.6, “User-Defined Function Security Precautions”.Use standard (ANSI) SQL syntax instead of MySQL syntax. For more precise control over the server SQL mode, use the
--sql-modeoption instead. See Section 1.7.3, “Running MySQL in ANSI Mode”, and Section 5.1.7, “Server SQL Modes”.The path to the MySQL installation directory. All paths are usually resolved relative to this directory.
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.
The IP address to bind to. Only one address can be selected. If this option is specified multiple times, the last address given is used.
If no address or
0.0.0.0is specified, the server listens on all interfaces.This option is used by the mysql_install_db script to create the MySQL privilege tables without having to start a full MySQL server.
The directory where character sets are installed. See Section 9.2, “The Character Set Used for Data and Sorting”.
--character-set-client-handshakeDon't ignore character set information sent by the client. To ignore client information and use the default server character set, use
--skip-character-set-client-handshake; this makes MySQL 4.1 and higher behave like MySQL 4.0. This option was added in MySQL 4.1.15.--character-set-server=,charset_name-Ccharset_nameUse
charset_nameas the default server character set. See Section 9.2, “The Character Set Used for Data and Sorting”. If you use this option to specify a nondefault character set, you should also use--collation-serverto specify the collation. This option is available as of MySQL 4.1.3.--chroot=,path-rpathPut the mysqld server in a closed environment during startup by using the
chroot()system call. This is a recommended security measure as of MySQL 4.0. (MySQL 3.23 is not able to provide achroot()jail that is 100% closed.) Note that use of this option somewhat limitsLOAD DATA INFILEandSELECT ... INTO OUTFILE.--collation-server=collation_nameUse
collation_nameas the default server collation. This option is available as of MySQL 4.1.3. See Section 9.2, “The Character Set Used for Data and Sorting”.(Windows only.) Write error log messages to
stderrandstdouteven if--log-erroris specified. mysqld does not close the console window if this option is used.Write a core file if mysqld dies. The name and location of the core file is system dependent. On Linux, a core file named
core.is written to the current working directory of the process, which for mysqld is the data directory.pidpidrepresents the process ID of the server process. On Mac OS X, a core file namedcore.is written to thepid/coresdirectory. On Solaris, use the coreadm command to specify where to write the core file and how to name it.For some systems, to get a core file you must also specify the
--core-file-sizeoption to mysqld_safe. See Section 4.3.2, “mysqld_safe — MySQL Server Startup Script”. On some systems, such as Solaris, you do not get a core file if you are also using the--useroption. There might be additional restrictions or limitations. For example, it might be necessary to execute ulimit -c unlimited before starting the server. Consult your system documentation.--datadir=,path-hpathThe path to the data directory.
--debug[=,debug_options]-# [debug_options]If MySQL is configured with
--with-debug, you can use this option to get a trace file of what mysqld is doing. A typicaldebug_optionsstring is'd:t:o,. The default isfile_name''d:t:i:o,mysqld.trace'. See MySQL Internals: Porting.--default-character-set=,charset_name-Ccharset_nameUse
charset_nameas the default character set. This option is deprecated in favor of--character-set-serveras of MySQL 4.1.3. See Section 9.2, “The Character Set Used for Data and Sorting”.--default-collation=collation_nameUse
collation_nameas the default collation. This option is deprecated in favor of--collation-serveras of MySQL 4.1.3. See Section 9.2, “The Character Set Used for Data and Sorting”.This option is a synonym for
--default-table-type. It is available as of MySQL 4.1.2.Set the default table type (storage engine) for tables. See Chapter 13, Storage Engines.
Set the default server time zone. This option sets the global
time_zonesystem variable. If this option is not given, the default time zone is the same as the system time zone (given by the value of thesystem_time_zonesystem variable. This option is available as of MySQL 4.1.3.--delay-key-write[={OFF|ON|ALL}]Specify how to use delayed key writes. Delayed key writing causes key buffers not to be flushed between writes for
MyISAMtables.OFFdisables delayed key writes.ONenables delayed key writes for those tables that were created with theDELAY_KEY_WRITEoption.ALLdelays key writes for allMyISAMtables. Available as of MySQL 4.0.3. See Section 7.5.3, “Tuning Server Parameters”, and Section 13.1.1, “MyISAMStartup Options”.Note
If you set this variable to
ALL, you should not useMyISAMtables from within another program (such as another MySQL server or myisamchk) when the tables are in use. Doing so leads to index corruption.--delay-key-write-for-all-tablesOld form of
--delay-key-write=ALLfor use prior to MySQL 4.0.3. As of 4.0.3, use--delay-key-writeinstead.Read the default DES keys from this file. These keys are used by the
DES_ENCRYPT()andDES_DECRYPT()functions.Enable support for named pipes. This option applies only on Windows NT, 2000, XP, and 2003 systems, and can be used only with the mysqld-nt and mysqld-max-nt servers that support named-pipe connections.
Print a symbolic stack trace on failure.
--exit-info[=,flags]-T [flags]This is a bit mask of different flags that you can use for debugging the mysqld server. Do not use this option unless you know exactly what it does!
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
lockddoes not fully work (such as Linux), it is easy for mysqld to deadlock. This option was named--enable-lockingbefore MySQL 4.0.3.For more information about external locking, including conditions under which it can and cannot be used, see Section 7.3.4, “External Locking”.
Flush (synchronize) all changes to disk after each SQL statement. Normally, MySQL does a write of all changes to disk only after each SQL statement and lets the operating system handle the synchronizing to disk. See Section A.1.4.2, “What to Do If MySQL Keeps Crashing”.
Install an interrupt handler for
SIGINT(needed to stop mysqld with^Cto set breakpoints) and disable stack tracing and core file handling. See MySQL Internals: Porting. This option was added in MySQL 4.0.14.Read SQL statements from this file at startup. Each statement must be on a single line and should not include comments.
If this option is given, then after a crash recovery by
InnoDB, mysqld truncates the binary log after the last not-rolled-back transaction in the log. The option also causesInnoDBto print an error if the binary log is smaller or shorter than it should be. See Section 5.3.4, “The Binary Log”.--innodb-xxxThe
InnoDBoptions are listed in Section 13.2.4, “InnoDBStartup Options and System Variables”.--language=lang_name, -Llang_nameReturn client error messages in the given language.
lang_namecan be given as the language name or as the full path name to the directory where the language files are installed. See Section 9.3, “Setting the Error Message Language”.--log[=,file_name]-l [file_name]Log connections and SQL statements received from clients to this file. See Section 5.3.2, “The General Query Log”. If you omit the file name, MySQL uses
as the file name.host_name.logLog errors and startup messages to this file. See Section 5.3.1, “The Error Log”. If you omit the file name, MySQL uses
. If the file name has no extension, the server adds an extension ofhost_name.err.err.Log all
ISAM/MyISAMchanges to this file (used only when debuggingISAM/MyISAM).Log extra information to the update log, binary update log, and slow query log, if they have been activated. For example, the user name and timestamp are logged for queries. Before MySQL 4.1, if you are using
--log-slow-queriesand--log-long-format, queries that are not using indexes also are logged to the slow query log.--log-long-formatis deprecated as of MySQL version 4.1, when--log-short-formatwas introduced. (Long log format is the default setting since version 4.1.) Also note that starting with MySQL 4.1, the--log-queries-not-using-indexesoption is available for the purpose of logging queries that do not use indexes to the slow query log.--log-queries-not-using-indexesIf you are using this option with the slow query log enabled, queries that are expected to retrieve all rows are logged. See Section 5.3.5, “The Slow Query Log”. This option does not necessarily mean that no index is used. For example, a query that uses a full index scan uses an index but would be logged because the index would not limit the number of rows. This option is available as of MySQL 4.1.
Originally intended to log less information to the update log, binary log and slow query log, if they have been activated. This option was introduced in MySQL 4.1, but is not operational.
Log slow administrative statements such as
OPTIMIZE TABLE,ANALYZE TABLE, andALTER TABLEto the slow query log.This option was added in MySQL 4.1.13. (It is unnecessary in MySQL 4.0 because slow administrative statements are logged by default.)
--log-slow-queries[=file_name]Log all queries that have taken more than
long_query_timeseconds to execute to this file. See Section 5.3.5, “The Slow Query Log”. Note that the default for the amount of information logged has changed in MySQL 4.1. See the--log-long-formatand--log-short-formatoptions for details.Log updates to
fileNwhereNis a unique number if not given. See Section 5.3.3, “The Update Log”. The update log is now deprecated; you should use the binary log instead (--log-bin). See Section 5.3.4, “The Binary Log”.--log-warnings[=,level]-W [level]Print out warnings such as
Aborted connection...to the error log. Enabling this option is recommended, for example, if you use replication (you get more information about what is happening, such as messages about network failures and reconnections). This option is enabled by default as of MySQL 4.0.19 and 4.1.2; to disable it, use--log-warnings=0. As of MySQL 4.0.21 and 4.1.3, alevelargument can be given. If omitted, the defaultlevelis 1. If the value is greater than 1, aborted connections are written to the error log. See Section A.1.2.11, “Communication Errors and Aborted Connections”.If a slave server was started with
--log-warningsenabled, the slave prints messages to the error log to provide information about its status, such as the binary log and relay log coordinates where it starts its job, when it is switching to another relay log, when it reconnects after a disconnect, and so forth.Before MySQL 4.0.21 and 4.1.3, this is a boolean option, not an integer-valued option. Before 4.0, this option was named
--warnings.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 bySET LOW_PRIORITY_UPDATES=1to 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”.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.
--memlockworks on systems that support themlockall()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 notmlockall()(and thus this option) is supported by checking to see whether or not it is defined in the systemmman.hfile, like this:shell>
grep mlockall /usr/include/sys/mman.hIf
mlockall()is supported, you should see in the output of the previous command something like the following:extern int mlockall (int __flags) __THROW;
Important
Using this option requires that you run the server as
root, which, for reasons of security, is normally not a good idea. See Section 5.4.5, “How to Run MySQL as a Normal User”.You must not try to use this option on a system that does not support the
mlockall()system call; if you do so, mysqld will very likely crash as soon as you try to start it.The block size to be used for
MyISAMindex pages.--myisam-recover[=option[,option]...]]Set the
MyISAMstorage engine recovery mode. The option value is any combination of the values ofDEFAULT,BACKUP,FORCE, orQUICK. If you specify multiple values, separate them by commas. You can also use a value of""to disable this option. If this option is used, each time mysqld opens aMyISAMtable, 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.
Option Description DEFAULTRecovery without backup, forcing, or quick checking. BACKUPIf the data file was changed during recovery, save a backup of the file astbl_name.MYD.tbl_name-datetime.BAKFORCERun recovery even if we would lose more than one row from the .MYDfile.QUICKdo not check the rows in the table if there are not any delete blocks. Before the server automatically repairs a table, it writes a note about the repair to the error log. If you want to be able to recover from most problems without user intervention, you should use the options
BACKUP,FORCE. This forces a repair of a table even if some rows would be deleted, but it keeps the old data file as a backup so that you can later examine what happened.See Section 13.1.1, “
MyISAMStartup Options”.This option is available as of MySQL 3.23.25.
The
--newoption can be used to make the server behave as 4.1 in certain respects, easing a 4.0 to 4.1 upgrade:Hexadecimal strings such as
0xFFare treated as strings by default rather than as numbers. (Works in 4.0.12 and up.)TIMESTAMPis returned as a string with the format'YYYY-MM-DD HH:MM:SS'. (Works in 4.0.13 and up.) See Chapter 10, Data Types.
This option can be used to help you see how your applications behave in MySQL 4.1, without actually upgrading to 4.1.
Force the server to generate short (pre-4.1) password hashes for new passwords. This is useful for compatibility when the server must support older client programs. See Section 5.6.6.3, “Password Hashing in MySQL”.
--old-protocol,-oUse the 3.20 protocol for compatibility with some very old clients. This option was removed in MySQL 4.1.1.
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.
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 withsetrlimit(). 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_connectionsandtable_cacheto estimate whether more descriptors will be needed.The path name of the process ID file. This file is used by other programs such as mysqld_safe to determine the server's process ID.
--port=,port_num-Pport_numThe 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
rootsystem user.Skip some optimization stages.
With this option, the
SHOW DATABASESstatement displays only the names of those databases for which the user has some kind of privilege. As of MySQL 4.0.2, this option is deprecated and does not do anything (it is enabled by default), because there is aSHOW DATABASESprivilege that can be used to control access to database names on a per-account basis. See Section 5.5.1, “Privileges Provided by MySQL”.If this option is enabled, a user cannot create new MySQL users by using the
GRANTstatement, if the user doesn't have theINSERTprivilege for themysql.usertable or any column in the table.Disallow authentication by clients that attempt to use accounts that have old (pre-4.1) passwords. This option is available as of MySQL 4.1.1.
Enable shared-memory connections by local clients. This option is available only on Windows. It was added in MySQL 4.1.0.
--shared-memory-base-name=nameThe name of shared memory to use for shared-memory connections. This option is available only on Windows. The default name is
MYSQL. The name is case sensitive. This option was added in MySQL 4.1.0.Disable the
BDBstorage engine. This saves memory and might speed up some operations. Do not use this option if you requireBDBtables.Turn off the ability to select and insert at the same time on
MyISAMtables. (This is to be used only if you think you have found a bug in this feature.) See Section 7.3.3, “Concurrent Inserts”.Ignore the
DELAY_KEY_WRITEoption for all tables. As of MySQL 4.0.3, you should use--delay-key-write=OFFinstead. See Section 7.5.3, “Tuning Server Parameters”.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.
This option causes the server to start without using the privilege system at all, which gives anyone with access to the server unrestricted access to all databases. You can cause a running server to start using the grant tables again by executing mysqladmin flush-privileges or mysqladmin reload command from a system shell, or by issuing a MySQL
FLUSH PRIVILEGESstatement after connecting to the server. This option also suppresses loading of user-defined functions (UDFs).Do not use the internal host name cache for faster name-to-IP resolution. Instead, query the DNS server every time a client connects. See Section 7.5.9, “How MySQL Uses DNS”.
Disable the
InnoDBstorage engine. This saves memory and disk space and might speed up some operations. Do not use this option if you requireInnoDBtables.Disable the
ISAMstorage engine. As of MySQL 4.1,ISAMis disabled by default, so this option applies only if the server was configured with support forISAM. This option was added in MySQL 4.1.1.Disable the
MERGEstorage engine. This option was added in MySQL 4.1.21. It can be used if the following behavior is undesirable: If a user has access toMyISAMtablet, that user can create aMERGEtablemthat accessest. However, if the user's privileges ontare subsequently revoked, the user can continue to accesstby doing so throughm.Do not resolve host names when checking client connections. Use only IP numbers. If you use this option, all
Hostcolumn values in the grant tables must be IP numbers orlocalhost. See Section 7.5.9, “How MySQL Uses DNS”.Do not listen for TCP/IP connections at all. All interaction with mysqld must be made via named pipes or shared memory (on Windows) or Unix socket files (on Unix). This option is highly recommended for systems where only local clients are allowed. See Section 7.5.9, “How MySQL Uses DNS”.
Do not use new, possibly wrong routines.
This is the old form of
--skip-symbolic-links, for use before MySQL 4.0.13.Options that begin with
--sslspecify whether to allow clients to connect via SSL and indicate where to find SSL keys and certificates. See Section 5.6.7.3, “SSL Command Options”.Available on Windows NT-based systems only; instructs the MySQL server not to run as a service.
--symbolic-links,--skip-symbolic-linksEnable or disable symbolic link support. This option has different effects on Windows and Unix:
On Windows, enabling symbolic links allows you to establish a symbolic link to a database directory by creating a
file that contains the path to the real directory. See Section 7.6.1.3, “Using Symbolic Links for Databases on Windows”.db_name.symOn Unix, enabling symbolic links means that you can link a
MyISAMindex file or data file to another directory with theINDEX DIRECTORYorDATA DIRECTORYoptions of theCREATE TABLEstatement. If you delete or rename the table, the files that its symbolic links point to also are deleted or renamed. See Section 7.6.1.2, “Using Symbolic Links for Tables on Unix”.
This option was added in MySQL 4.0.13.
If MySQL is configured with
--with-debug=full, all MySQL programs check for memory overruns during each memory allocation and memory freeing operation. This checking is very slow, so for the server you can avoid it when you do not need it by using the--skip-safemallocoption.With this option, the
SHOW DATABASESstatement is allowed only to users who have theSHOW DATABASESprivilege, and the statement displays all database names. Without this option,SHOW DATABASESis allowed to all users, but displays each database name only if the user has theSHOW DATABASESprivilege or some privilege for the database. Note that any global privilege is considered a privilege for the database.do not write stack traces. This option is useful when you are running mysqld under a debugger. On some systems, you also must use this option to get a core file. See MySQL Internals: Porting.
Disable using thread priorities for faster response time.
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 isMySQL(not case sensitive).--sql-mode=value[,value[,value...]]Set the SQL mode. See Section 5.1.7, “Server SQL Modes”. This option was added in 3.23.41.
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.
Sets the default transaction isolation level. The
levelvalue can beREAD-UNCOMMITTED,READ-COMMITTED,REPEATABLE-READ, orSERIALIZABLE. See Section 12.4.6, “SET TRANSACTIONSyntax”.--tmpdir=,path-tpathThe path of the directory to use for creating temporary files. It might be useful if your default
/tmpdirectory resides on a partition that is too small to hold temporary tables. Starting from MySQL 4.1.0, this option accepts several paths that are used in round-robin fashion. Paths should be separated by colon characters (“:”) on Unix and semicolon characters (“;”) on Windows, NetWare, and OS/2. If the MySQL server is acting as a replication slave, you should not set--tmpdirto point to a directory on a memory-based file system or to a directory that is cleared when the server host restarts. For more information about the storage location of temporary files, see Section A.1.4.4, “Where MySQL Stores Temporary Files”. A replication slave needs some of its temporary files to survive a machine restart so that it can replicate temporary tables orLOAD DATA INFILEoperations. If files in the temporary file directory are lost when the server restarts, replication fails.--user={,user_name|user_id}-u {user_name|user_id}Run the mysqld server as the user having the name
user_nameor the numeric user IDuser_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 asroot. See Section 5.4.1, “General Security Guidelines”.Starting from MySQL 3.23.56 and 4.0.12: To avoid a possible security hole where a user adds a
--user=rootoption to amy.cnffile (thus causing the server to run asroot), mysqld uses only the first--useroption specified and produces a warning if there are multiple--useroptions. Options in/etc/my.cnfand$MYSQL_HOME/my.cnfare processed before command-line options, so it is recommended that you put a--useroption in/etc/my.cnfand specify a value other thanroot. The option in/etc/my.cnfis found before any other--useroptions, which ensures that the server runs as a user other thanroot, and that a warning results if any other--useroption is found.As of MySQL 4.1.1, use this option with the
--helpoption for detailed help.--version,-VDisplay version information and exit.
As of MySQL 4.0, you can assign a value to a server system
variable by using an option of the form
--.
For example, var_name=value--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-
command-line option.
var_name=value
It is also possible to set variables by using
--set-variable=
or
var_name=value--
syntax. This syntax is deprecated as of MySQL
4.0.
var_name=value
You can change the values of most system variables for a running
server with the
SET
statement. See Section 12.5.4, “SET Syntax”.
Section 5.1.3, “Server System Variables”, provides a full description for all variables, and additional information for setting them at server startup and runtime. Section 7.5.3, “Tuning Server Parameters”, includes information on optimizing the server by tuning system variables.
The MySQL server maintains many system variables that indicate how
it is configured. Each system variable has a default value. System
variables can be set at server startup using options on the
command line or in an option file. As of MySQL 4.0.3, most of them
can be changed dynamically while the server is running by means of
the SET
statement, which enables you to modify operation of the server
without having to stop and restart it. You can refer to system
variable values in expressions.
There are several ways to see the names and values of system variables:
To see the values that a server will use based on its compiled-in defaults and any option files that it reads, use this command (omit
--verbosebefore MySQL 4.1.1):mysqld --verbose --help
To see the values that a server will use based on its compiled-in defaults, ignoring the settings in any option files, use this command (omit
--verbosebefore MySQL 4.1.1):mysqld --no-defaults --verbose --help
To see the current values used by a running server, use the
SHOW VARIABLESstatement.
This section provides a description of each system variable. Variables with no version indicated have been present since at least MySQL 3.22.
The following table lists all available system variables:
For additional system variable information, see these sections:
Section 5.1.4, “Session System Variables”, describes system variables that exist only as session variables (that is, they do not have any global counterpart).
Section 5.1.5, “Using System Variables”, discusses the syntax for setting and displaying system variable values.
Section 5.1.5.2, “Dynamic System Variables”, lists the variables that can be set at runtime.
Information on tuning system variables can be found in Section 7.5.3, “Tuning Server Parameters”.
Section 13.2.4, “
InnoDBStartup Options and System Variables”, listsInnoDBsystem variables.Section 15.4.3, “MySQL Cluster System Variables”, lists system variables which are specific to MySQL Cluster.
For information on server system variables specific to replication, see Section 14.8, “Replication and Binary Logging Options and Variables”.
Note
Some of the following variable descriptions refer to
“enabling” or “disabling” a variable.
These variables can be enabled with the
SET
statement by setting them to ON or
1, or disabled by setting them to
OFF or 0. However, to set
such a variable on the command line or in an option file, you
must set it to 1 or 0;
setting it to ON or OFF
will not work. For example, on the command line,
--delay_key_write=1 works but
--delay_key_write=ON does not.
Values for buffer sizes, lengths, and stack sizes are given in bytes unless otherwise specified.
Some system variables control the size of buffers or caches. For a given buffer, the server might need to allocate internal data structures. These structures typically are allocated from the total memory allocated to the buffer, and the amount of space required might be platform dependent. This means that when you assign a value to a system variable that controls a buffer size, the amount of space actually available might differ from the value assigned. In some cases, the amount might be less than the value assigned. It is also possible that the server will adjust a value upward. For example, if you assign a value of 0 to a variable for which the minimal value is 1024, the server will set the value to 1024.
This is
ONif mysqld was started with--ansi. See Section 1.7.3, “Running MySQL in ANSI Mode”. This variable was added in MySQL 3.23.6 and removed in 3.23.41. See the description forsql_mode.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_logvalue indicates how many requests can be stacked during this short time before MySQL momentarily stops answering new requests. You need to increase this only if you expect a large number of connections in a short period of time.In other words, this value is the size of the listen queue for incoming TCP/IP connections. Your operating system has its own limit on the size of this queue. The manual page for the Unix
listen()system call should have more details. Check your OS documentation for the maximum value for this variable.back_logcannot be set higher than your operating system limit.The MySQL installation base directory. This variable can be set with the
--basediroption. Relative path names for other variables usually are resolved relative to the base directory.The size of the buffer that is allocated for caching indexes and rows for
BDBtables. If you do not useBDBtables, you should start mysqld with--skip-bdbto not allocate memory for this cache. This variable was added in MySQL 3.23.14.The base directory for
BDBtables. This should be assigned the same value as thedatadirvariable. This variable was added in MySQL 3.23.14.The size of the buffer that is allocated for caching indexes and rows for
BDBtables. If you do not useBDBtables, you should set this to 0 or start mysqld with--skip-bdbin order not to allocate memory for this cache. This variable was added in MySQL 3.23.31.The directory where the
BDBstorage engine writes its log files. This variable can be set with the--bdb-logdiroption. This variable was added in MySQL 3.23.14.The maximum number of locks that can be active for a
BDBtable (10,000 by default). You should increase this value if errors such as the following occur when you perform long transactions or when mysqld has to examine many rows to calculate a query:bdb: Lock table is out of available locks Got error 12 from ...
This variable was added in MySQL 3.23.29.
This is
ONif you are using--bdb-shared-datato start Berkeley DB in multi-process mode. (Do not useDB_PRIVATEwhen initializing Berkeley DB.) This variable was added in MySQL 3.23.29.The
BDBtemporary file directory. This variable was added in MySQL 3.23.14.See the description for
version_bdb.The size of the cache to hold the SQL statements for the binary log during a transaction. A binary log cache is allocated for each client if the server supports any transactional storage engines and, starting from MySQL 4.1.2, if the server has the binary log enabled (
--log-binoption). If you often use large, multiple-statement transactions, you can increase this cache size to get more performance. TheBinlog_cache_useandBinlog_cache_disk_usestatus variables can be useful for tuning the size of this variable. This variable was added in MySQL 3.23.29. See Section 5.3.4, “The Binary Log”.MySQL Enterprise For recommendations on the optimum setting for
binlog_cache_sizesubscribe to the MySQL Enterprise Monitor. For more information, see http://www.mysql.com/products/enterprise/advisors.html.MyISAMuses a special tree-like cache to make bulk inserts faster forINSERT ... SELECT,INSERT ... VALUES (...), (...), ..., andLOAD DATA INFILEwhen adding data to nonempty tables. This variable limits the size of the cache tree in bytes per thread. Setting it to 0 disables this optimization. The default value is 8MB. Before MySQL 4.0.3. this variable was namedmyisam_bulk_insert_tree_size.The default character set. This variable was added in MySQL 3.23.3, then removed in MySQL 4.1.1 and replaced by the various
character_set_variables.xxxThe character set for statements that arrive from the client. This variable was added in MySQL 4.1.1.
The session value of this variable is set using the character set requested by the client when the client connects to the server. (Many clients support a
--default-character-setoption 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
sjiswhen connecting to a server not configured withsjissupport.mysqld was started with the
--skip-character-set-client-handshakeoption, which causes it to ignore client character set configuration. This reproduces MySQL 4.0 behavior and is useful should you wish to upgrade the server without upgrading all the clients.
The character set used for literals that do not have a character set introducer and for number-to-string conversion. This variable was added in MySQL 4.1.1.
The character set used by the default database. The server sets this variable whenever the default database changes. If there is no default database, the variable has the same value as
character_set_server. This variable was added in MySQL 4.1.1.The character set used for returning query results to the client. This variable was added in MySQL 4.1.1.
The server default character set. This variable was added in MySQL 4.1.1.
The character set used by the server for storing identifiers. The value is always
utf8. This variable was added in MySQL 4.1.1.The supported character sets. This variable was added in MySQL 3.23.15 and removed in MySQL 4.1.1. (Use
SHOW CHARACTER SETfor a list of character sets.)The directory where character sets are installed. This variable was added in MySQL 4.1.2.
The collation of the connection character set. This variable was added in MySQL 4.1.1.
The collation used by the default database. The server sets this variable whenever the default database changes. If there is no default database, the variable has the same value as
collation_server. This variable was added in MySQL 4.1.1.The server default collation. This variable was added in MySQL 4.1.1.
If
ON(the default), MySQL allowsINSERTandSELECTstatements to run concurrently forMyISAMtables that have no free blocks in the middle of the data file. You can turn this option off by starting mysqld with--safe-modeor--skip-new. This variable was added in MySQL 3.23.7.See also Section 7.3.3, “Concurrent Inserts”.
The number of seconds that the mysqld server waits for a connect packet before responding with
Bad handshake. The default value is 5 seconds.Increasing the
connect_timeoutvalue might help if clients frequently encounter errors of the formLost connection to MySQL server at '.XXX', system error:errnoThe current character set mapping that was set by
SET CHARACTER SET. This variable was removed in MySQL 4.1.The MySQL data directory. This variable can be set with the
--datadiroption.This variable is unused.
This variable is unused.
The default mode value to use for the
WEEK()function. See Section 11.6, “Date and Time Functions”. This variable is available as of MySQL 4.0.14.This option applies only to
MyISAMtables. It can have one of the following values to affect handling of theDELAY_KEY_WRITEtable option that can be used inCREATE TABLEstatements.Option Description OFFDELAY_KEY_WRITEis ignored.ONMySQL honors any DELAY_KEY_WRITEoption specified inCREATE TABLEstatements. This is the default value.ALLAll new opened tables are treated as if they were created with the DELAY_KEY_WRITEoption enabled.If
DELAY_KEY_WRITEis enabled for a table, the key buffer is not flushed for the table on every index update, but only when the table is closed. This speeds up writes on keys a lot, but if you use this feature, you should add automatic checking of allMyISAMtables by starting the server with the--myisam-recoveroption (for example,--myisam-recover=BACKUP,FORCE). See Section 5.1.2, “Server Command Options”, and Section 13.1.1, “MyISAMStartup Options”.Warning
If you enable external locking with
--external-locking, there is no protection against index corruption for tables that use delayed key writes.This variable was added in MySQL 3.23.8.
After inserting
delayed_insert_limitdelayed rows, theINSERT DELAYEDhandler thread checks whether there are anySELECTstatements pending. If so, it allows them to execute before continuing to insert delayed rows.How many seconds an
INSERT DELAYEDhandler thread should wait forINSERTstatements before terminating.This is a per-table limit on the number of rows to queue when handling
INSERT DELAYEDstatements. If the queue becomes full, any client that issues anINSERT DELAYEDstatement waits until there is room in the queue again.The number of days for automatic binary log removal. The default is 0, which means “no automatic removal.” Possible removals happen at startup and at binary log rotation. This variable was added in MySQL 4.1.0.
If
ON, the server flushes (synchronizes) all changes to disk after each SQL statement. Normally, MySQL does a write of all changes to disk only after each SQL statement and lets the operating system handle the synchronizing to disk. See Section A.1.4.2, “What to Do If MySQL Keeps Crashing”. This variable is set toONif you start mysqld with the--flushoption. This variable was added in MySQL 3.22.9.If this is set to a nonzero value, all tables are closed every
flush_timeseconds to free up resources and synchronize unflushed data to disk. This option is best used only on Windows 9x or Me, or on systems with minimal resources. This variable was added in MySQL 3.22.18.The list of operators supported by boolean full-text searches performed using
IN BOOLEAN MODE. See Section 11.8.2, “Boolean Full-Text Searches”. This variable was added as a read-only variable in MySQL 4.0.1. It can be modified as of MySQL 4.1.2.The default variable value is
'+ -><()~*:""&|'. The rules for changing the value are as follows:Operator function is determined by position within the string.
The replacement value must be 14 characters.
Each character must be an ASCII nonalphanumeric character.
Either the first or second character must be a space.
No duplicates are allowed except the phrase quoting operators in positions 11 and 12. These two characters are not required to be the same, but they are the only two that may be.
Positions 10, 13, and 14 (which by default are set to “
:”, “&”, and “|”) are reserved for future extensions.
The maximum length of the word to be included in a
FULLTEXTindex. This variable was added in MySQL 4.0.0.Note
FULLTEXTindexes must be rebuilt after changing this variable. UseREPAIR TABLE.tbl_nameQUICKThe minimum length of the word to be included in a
FULLTEXTindex. This variable was added in MySQL 4.0.0.Note
FULLTEXTindexes must be rebuilt after changing this variable. UseREPAIR TABLE.tbl_nameQUICKThe number of top matches to use for full-text searches performed using
WITH QUERY EXPANSION. This variable was added in MySQL 4.1.1.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.cfile). Setting this variable to the empty string ('') disables stopword filtering. This variable was added in MySQL 4.0.10.Note
FULLTEXTindexes must be rebuilt after changing this variable or the contents of the stopword file. UseREPAIR TABLE.tbl_nameQUICKThe maximum allowed result length in bytes for the
GROUP_CONCAT()function. The default is 1024. This variable was added in MySQL 4.1.0.YESif mysqld supportsARCHIVEtables,NOif not. This variable was added in MySQL 4.1.3.YESif mysqld supportsBDBtables.DISABLEDif--skip-bdbis used. This variable was added in MySQL 3.23.30.YESif mysqld supportsBLACKHOLEtables,NOif not. This variable was added in MySQL 4.1.11.YESif thezlibcompression library is available to the server,NOif not. If not, theCOMPRESS()andUNCOMPRESS()functions cannot be used. This variable was added in MySQL 4.1.1.YESif thecrypt()system call is available to the server,NOif not. If not, theENCRYPT()function cannot be used. This variable was added in MySQL 4.0.10.YESif mysqld supportsARCHIVEtables,NOif not. This variable was added in MySQL 4.1.4.YESif mysqld supportsEXAMPLEtables,NOif not. This variable was added in MySQL 4.1.4.YESif the server supports spatial data types,NOif not. This variable was added in MySQL 4.1.3.YESif mysqld supportsInnoDBtables.DISABLEDif--skip-innodbis used. This variable was added in MySQL 3.23.37.YESif mysqld supportsISAMtables.DISABLEDif--skip-isamis used. This variable was added in MySQL 3.23.30.YESif mysqld supportsMERGEtables.DISABLEDif--skip-mergeis used. This variable was added in MySQL 4.1.21.YESif mysqld supports SSL (encryption) connections,NOif not. This variable was added in MySQL 3.23.43.YESif mysqld supports the query cache,NOif not. This variable was added in MySQL 4.0.2.YESif mysqld supports theRAIDoption,NOif not. This variable was added in MySQL 3.23.30.YESifRTREEindexes are available,NOif not. (These are used for spatial indexes inMyISAMtables.) This variable was added in MySQL 4.1.3.YESif symbolic link support is enabled,NOif not. This is required on Unix for support of theDATA DIRECTORYandINDEX DIRECTORYtable options, and on Windows for support of data directory symlinks.This variable was added in MySQL 4.0.0.
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_connectcan 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_connectis not executed for users that have theSUPERprivilege. This is done so that an erroneous value forinit_connectdoes not prevent all clients from connecting. For example, the value might contain a statement that has a syntax error, thus causing client connections to fail. Not executinginit_connectfor users that have theSUPERprivilege enables them to open a connection and fix theinit_connectvalue.This variable was added in MySQL 4.1.2.
The name of the file specified with the
--init-fileoption when you start the server. This should be a file containing SQL statements that you want the server to execute when it starts. Each statement must be on a single line and should not include comments. This variable was added in MySQL 3.23.2.innodb_xxxInnoDBsystem variables are listed in Section 13.2.4, “InnoDBStartup Options and System Variables”.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_INTERACTIVEoption tomysql_real_connect(). See alsowait_timeout.The size of the buffer that is used for plain index scans, range index scans, and joins that do not use indexes and thus perform full table scans. Normally, the best way to get fast joins is to add indexes. Increase the value of
join_buffer_sizeto get a faster full join when adding indexes is not possible. One join buffer is allocated for each full join between two tables. For a complex join between several tables for which indexes are not used, multiple join buffers might be necessary.Index blocks for
MyISAMandISAMtables are buffered and are shared by all threads.key_buffer_sizeis the size of the buffer used for index blocks. The key buffer is also known as the key cache.The maximum allowable setting for
key_buffer_sizeis 4GB. The effective maximum size might be less, depending on your available physical RAM and per-process RAM limits imposed by your operating system or hardware platform. The value of this variable indicates the amount of memory requested. Internally, the server allocates as much memory as possible up to this amount, but the actual allocation might be less.Increase the value to get better index handling (for all reads and multiple writes) to as much as you can afford. Using a value that is 25% of total memory on a machine that mainly runs MySQL is quite common. However, if you make the value too large (for example, more than 50% of your total memory) your system might start to page and become extremely slow. MySQL relies on the operating system to perform file system caching for data reads, so you must leave some room for the file system cache. Consider also the memory requirements of other storage engines.
For even more speed when writing many rows at the same time, use
LOCK TABLES. See Section 7.2.14, “Speed ofINSERTStatements”.You can check the performance of the key buffer by issuing a
SHOW STATUSstatement and examining theKey_read_requests,Key_reads,Key_write_requests, andKey_writesstatus variables. (See Section 12.5.5, “SHOWSyntax”.) TheKey_reads/Key_read_requestsratio should normally be less than 0.01. TheKey_writes/Key_write_requestsratio is usually near 1 if you are using mostly updates and deletes, but might be much smaller if you tend to do updates that affect many rows at the same time or if you are using theDELAY_KEY_WRITEtable option.The fraction of the key buffer in use can be determined using
key_buffer_sizein conjunction with theKey_blocks_unusedstatus variable and the buffer block size. From MySQL 4.1.1 on, the buffer block size is available from thekey_cache_block_sizeserver variable. The fraction of the buffer in use is:1 - ((Key_blocks_unused × key_cache_block_size) / key_buffer_size)
This value is an approximation because some space in the key buffer may be allocated internally for administrative structures.
Before MySQL 4.1.1, key cache blocks are 1024 bytes, and before MySQL 4.1.2,
Key_blocks_unusedis unavailable. TheKey_blocks_usedvariable can be used as follows to determine the fraction of the key buffer in use:(Key_blocks_used × 1024) / key_buffer_size
However,
Key_blocks_usedindicates the maximum number of blocks that have ever been in use at once, so this formula does not necessarily represent the current fraction of the buffer that is in use.As of MySQL 4.1, it is possible to create multiple
MyISAMkey caches. The size limit of 4GB applies to each cache individually, not as a group. See Section 7.4.5, “TheMyISAMKey Cache”.This value controls the demotion of buffers from the hot sub-chain of a key cache to the warm sub-chain. Lower values cause demotion to happen more quickly. The minimum value is 100. The default value is 300. This variable was added in MySQL 4.1.1. See Section 7.4.5, “The
MyISAMKey Cache”.The size in bytes of blocks in the key cache. The default value is 1024. This variable was added in MySQL 4.1.1. See Section 7.4.5, “The
MyISAMKey Cache”.The division point between the hot and warm sub-chains of the key cache buffer chain. The value is the percentage of the buffer chain to use for the warm sub-chain. Allowable values range from 1 to 100. The default value is 100. This variable was added in MySQL 4.1.1. See Section 7.4.5, “The
MyISAMKey Cache”.The language used for error messages.
Whether mysqld was compiled with options for large file support. This variable was added in MySQL 3.23.28.
This variable specifies the locale that controls the language used to display day and month names and abbreviations. This variable affects the output from the
DATE_FORMAT(),DAYNAME()andMONTHNAME()functions. Locale names are POSIX-style values such as'ja_JP'or'pt_BR'. The default value is'en_US'regardless of your system's locale setting. For further information, see Section 9.8, “MySQL Server Locale Support”. This variable was added in MySQL 4.1.21.The type of license the server has. This variable was added in MySQL 4.0.19.
Whether
LOCALis supported forLOAD DATA INFILEstatements. See Section 5.4.4, “Security Issues withLOAD DATA LOCAL”. This variable was added in MySQL 4.0.3.Whether mysqld was locked in memory with
--memlock. This variable was added in MySQL 3.23.25.Whether logging of all statements to the general query log is enabled. See Section 5.3.2, “The General Query Log”.
The location of the error log. This variable was added in MySQL 4.0.10.
Whether slow queries should be logged. “Slow” is determined by the value of the
long_query_timevariable. This variable was added in MySQL 4.0.2. See Section 5.3.5, “The Slow Query Log”.Whether the update log is enabled. This variable was added in MySQL 3.22.18. Note that the binary log is preferable to the update log, which is unavailable as of MySQL 5.0. See Section 5.3.3, “The Update Log”.
Whether to produce additional warning messages. This variable was added in MySQL 4.0.3. It is enabled by default as of MySQL 4.0.19 and 4.1.2. As of MySQL 4.0.21 and 4.1.3, the variable can take values greater than 1 and aborted connections are not logged to the error log unless the value is greater than 1.
If a query takes longer than this many seconds, the server increments the
Slow_queriesstatus variable. If you are using the--log-slow-queriesoption, the query is logged to the slow query log file. This value is measured in real time, not CPU time, so a query that is under the threshold on a lightly loaded system might be above the threshold on a heavily loaded one. The minimum value is 1. The default is 10. See Section 5.3.5, “The Slow Query Log”.If set to
1, allINSERT,UPDATE,DELETE, andLOCK TABLE WRITEstatements wait until there is no pendingSELECTorLOCK TABLE READon the affected table. This affects only storage engines that use only table-level locking (MyISAM,MEMORY,MERGE). Before MySQL 3.22.5, this variable was namedsql_low_priority_updates.This variable describes the case sensitivity of file names on the file system where the data directory is located.
OFFmeans file names are case sensitive,ONmeans they are not case sensitive. This variable was added in MySQL 4.0.19.If set to 1 table names are stored in lowercase on disk and table name comparisons are not case sensitive. This variable was added in MySQL 3.23.6. If set to 2 (new in 4.0.18), table names are stored as given but compared in lowercase. From MySQL 4.0.2, this option also applies to database names. From 4.1.1, it also applies to table aliases. See Section 8.2.2, “Identifier Case Sensitivity”.
Note
If you are using
InnoDBtables, you should set this variable to 1 on all platforms to force names to be converted to lowercase.You should not set this variable to 0 if you are running MySQL on a system that does not have case-sensitive file names (such as Windows or Mac OS X). New in 4.0.18: If this variable is not set at startup and the file system on which the data directory is located does not have case-sensitive file names, MySQL automatically sets
lower_case_table_namesto 2.The maximum size of one packet or any generated/intermediate string.
The packet message buffer is initialized to
net_buffer_lengthbytes, but can grow up tomax_allowed_packetbytes when needed. This value by default is small, to catch large (possibly incorrect) packets.You must increase this value if you are using large
BLOBcolumns or long strings. It should be as big as the largestBLOByou want to use. The protocol limit formax_allowed_packetis 16MB before MySQL 4.0 and 1GB thereafter. The value should be a multiple of 1024; nonmultiples are rounded down to the nearest multiple.When you change the message buffer size by changing the value of the
max_allowed_packetvariable, you should also change the buffer size on the client side if your client program allows it. On the client side,max_allowed_packethas a default of 1GB. Some programs such as mysql and mysqldump enable you to change the client-side value by settingmax_allowed_packeton the command line or in an option file.If there are more than this number of interrupted connections from a host, that host is blocked from further connections. You can unblock blocked hosts with the
FLUSH HOSTSstatement.The number of simultaneous client connections allowed. By default, this is 100. See Section A.1.2.7, “
Too many connections”, for more information.MySQL Enterprise For notification that the maximum number of connections is getting dangerously high and for advice on setting the optimum value for
max_connectionssubscribe to the MySQL Enterprise Monitor. For more information, see http://www.mysql.com/products/enterprise/advisors.html.Increasing this value increases the number of file descriptors that mysqld requires. See Section 7.4.7, “How MySQL Opens and Closes Tables”, for comments on file descriptor limits.
Do not start more than this number of threads to handle
INSERT DELAYEDstatements. If you try to insert data into a new table after allINSERT DELAYEDthreads are in use, the row is inserted as if theDELAYEDattribute wasn't specified. If you set this to 0, MySQL never creates a thread to handleDELAYEDrows; in effect, doing so disablesDELAYEDentirely. This variable was added in MySQL 3.23.0.For the
SESSIONvalue of this variable, the only valid values are 0 or theGLOBALvalue.The maximum number of error, warning, and note messages to be stored for display by the
SHOW ERRORSorSHOW WARNINGSstatements. This variable was added in MySQL 4.1.0.This variable sets the maximum size to which
MEMORY(HEAP) tables are allowed to grow. The value of the variable is used to calculateMEMORYtableMAX_ROWSvalues. Setting this variable has no effect on any existingMEMORYtable, unless the table is re-created with a statement such asCREATE TABLE, or altered withALTER TABLEorTRUNCATE TABLE. A server restart also sets the maximum size of existingMEMORYtables to the globalmax_heap_table_sizevalue. This variable was added in MySQL 3.23.0.Note
On 64-bit platforms, the maximum value for this variable is 1844674407370954752.
MySQL Enterprise Subscribers to the MySQL Enterprise Monitor receive recommendations for the optimum setting for
max_heap_table_size. For more information, see http://www.mysql.com/products/enterprise/advisors.html.This variable is a synonym for
max_delayed_threads. It was added in MySQL 4.0.19.Do not allow
SELECTstatements that probably need to examine more thanmax_join_sizerows (for single-table statements) or row combinations (for multiple-table statements) or that are likely to do more thanmax_join_sizedisk seeks. By setting this value, you can catchSELECTstatements where keys are not used properly and that would probably take a long time. Set it if your users tend to perform joins that lack aWHEREclause, that take a long time, or that return millions of rows.Setting this variable to a value other than
DEFAULTresets the value ofsql_big_selectsto0. If you set thesql_big_selectsvalue again, themax_join_sizevariable is ignored.If a query result is in the query cache, no result size check is performed, because the result has previously been computed and it does not burden the server to send it to the client.
This variable previously was named
sql_max_join_size.The cutoff on the size of index values that determines which
filesortalgorithm to use. See Section 7.2.9, “ORDER BYOptimization”. This variable was added in MySQL 4.1.1This variable limits the total number of prepared statements in the server. It can be used in environments where there is the potential for denial-of-service attacks based on running the server out of memory by preparing huge numbers of statements. If the value is set lower than the current number of prepared statements, existing statements are not affected and can be used, but no new statements can be prepared until the current number drops below the limit. The default value is 16,382. The allowable range of values is from 0 to 1 million. Setting the value to 0 disables prepared statements. This variable was added in MySQL 4.1.19.
If a write by a replication slave to its relay log causes the current log file size to exceed the value of this variable, the slave rotates the relay logs (closes the current file and opens the next one). If
max_relay_log_sizeis 0, the server usesmax_binlog_sizefor both the binary log and the relay log. Ifmax_relay_log_sizeis greater than 0, it constrains the size of the relay log, which enables you to have different sizes for the two logs. You must setmax_relay_log_sizeto between 4096 bytes and 1GB (inclusive), or to0. The default value is0. This variable was added in MySQL 4.0.14. See Section 14.3, “Replication Implementation Details”.Limit the assumed maximum number of seeks when looking up rows based on a key. The MySQL optimizer assumes that no more than this number of key seeks are required when searching for matching rows in a table by scanning an index, regardless of the actual cardinality of the index (see Section 12.5.5.13, “
SHOW INDEXSyntax”). By setting this to a low value (say, 100), you can force MySQL to prefer indexes instead of table scans.This variable was added in MySQL 4.0.14.
The number of bytes to use when sorting
BLOBorTEXTvalues. Only the firstmax_sort_lengthbytes of each value are used; the rest are ignored.The maximum number of temporary tables a client can keep open at the same time. (This option does not yet do anything.)
The maximum number of simultaneous connections allowed to any given MySQL account. A value of
0means “no limit.” This variable was added in MySQL 3.23.34.This variable has only a global form.
After this many write locks, allow some pending read lock requests to be processed in between. This variable was added in MySQL 3.23.7.
The default pointer size in bytes, to be used by
CREATE TABLEforMyISAMtables when noMAX_ROWSoption is specified. This variable cannot be less than 2 or larger than 7. The default value is4. This variable was added in MySQL 4.1.2. See Section A.1.2.12, “The table is full”.myisam_max_extra_sort_file_sizeIf the temporary file used for fast
MyISAMindex creation would be larger than using the key cache by the amount specified here, prefer the key cache method. This is mainly used to force long character keys in large tables to use the slower key cache method to create the index. This variable was added in MySQL 3.23.37.Note
The value is given in megabytes before 4.0.3 and in bytes thereafter.
The maximum size of the temporary file that MySQL is allowed to use while re-creating a
MyISAMindex (duringREPAIR TABLE,ALTER TABLE, orLOAD DATA INFILE). If the file size would be larger than this value, the index is created using the key cache instead, which is slower. This variable was added in MySQL 3.23.37.Note
The value is given in megabytes before 4.0.3 and in bytes thereafter.
The default value is 2GB. If
MyISAMindex files exceed this size and disk space is available, increasing the value may help performance.The value of the
--myisam-recoveroption. See Section 5.1.2, “Server Command Options”. This variable was added in MySQL 3.23.36.If this value is greater than 1,
MyISAMtable indexes are created in parallel (each index in its own thread) during theRepair by sortingprocess. The default value is 1.Note
Multi-threaded repair is still beta-quality code. This variable was added in MySQL 4.0.13.
The size of the buffer that is allocated when sorting
MyISAMindexes during aREPAIR TABLEor when creating indexes withCREATE INDEXorALTER TABLE. This variable was added in MySQL 3.23.16.How the server treats
NULLvalues when collecting statistics about the distribution of index values forMyISAMtables. This variable has three possible values,nulls_equal,nulls_unequal, andnulls_ignored. Fornulls_equal, allNULLindex values are considered equal and form a single value group that has a size equal to the number ofNULLvalues. Fornulls_unequal,NULLvalues are considered unequal, and eachNULLforms a distinct value group of size 1. Fornulls_ignored,NULLvalues are ignored.The method that is used for generating table statistics influences how the optimizer chooses indexes for query execution, as described in Section 7.4.6, “
MyISAMIndex Statistics Collection”.Any unique prefix of a valid value may be used to set the value of this variable.
This variable was added in MySQL 4.1.15. For older versions, the statistics collection method is equivalent to
nulls_equal.On Windows, indicates whether the server supports connections over named pipes. This variable was added in MySQL 3.23.50.
Each client thread is associated with a connection buffer and result buffer. Both begin with a size given by
net_buffer_lengthbut are dynamically enlarged up tomax_allowed_packetbytes as needed. The result buffer shrinks tonet_buffer_lengthafter each SQL statement.This variable should not normally be changed, but if you have very little memory, you can set it to the expected length of statements sent by clients. If statements exceed this length, the connection buffer is automatically enlarged. The maximum value to which
net_buffer_lengthcan be set is 1MB.The number of seconds to wait for more data from a connection before aborting the read. This timeout applies only to TCP/IP connections, not to connections made via Unix socket files, named pipes, or shared memory. When the server is reading from the client,
net_read_timeoutis the timeout value controlling when to abort. When the server is writing to the client,net_write_timeoutis the timeout value controlling when to abort. See alsoslave_net_timeout. This variable was added in MySQL 3.23.20.If a read on a communication port is interrupted, retry this many times before giving up. This value should be set quite high on FreeBSD because internal interrupts are sent to all threads. This variable was added in MySQL 3.23.7.
The number of seconds to wait for a block to be written to a connection before aborting the write. This timeout applies only to TCP/IP connections, not to connections made via Unix socket files, named pipes, or shared memory. See also
net_read_timeout. This variable was added in MySQL 3.23.20.This variable is used in MySQL 4.0 to turn on some 4.1 behaviors. This variable was added in MySQL 4.0.12.
Whether the server should use pre-4.1-style passwords for MySQL user accounts. This variable was added in MySQL 4.1.1.
This is not a variable, but it can be used when setting some variables. It is described in Section 12.5.4, “
SETSyntax”.The number of files that the operating system allows mysqld to open. This is the real value allowed by the system and might be different from the value you gave using the
--open-files-limitoption to mysqld or mysqld_safe. The value is 0 on systems where MySQL can't change the number of open files. This variable was added in MySQL 3.23.20.The path name of the process ID (PID) file. This variable can be set with the
--pid-fileoption. This variable was added in MySQL 3.23.23.The path name of the plugin directory. This variable was added in MySQL 4.1.25. If the value is nonempty, user-defined function object files must be located in this directory. If the value is empty, the behavior that is used before 4.1.25 applies: The UDF object files must be located in a directory that is searched by your system's dynamic linker.
The number of the port on which the server listens for TCP/IP connections. This variable can be set with the
--portoption.The size of the buffer that is allocated when preloading indexes. This variable was added in MySQL 4.1.1.
The current number of prepared statements. (The maximum number of statements is given by the
max_prepared_stmt_countsystem variable.) This variable was added in MySQL 4.1.19. In MySQL 4.1.23, it was converted to the globalPrepared_stmt_countstatus variable.The version of the client/server protocol used by the MySQL server. This variable was added in MySQL 3.23.18.
Variable Name pseudo_thread_idVariable Scope Both Dynamic Variable Yes Value Set Type numericThis variable is for internal server use.
The allocation size of memory blocks that are allocated for objects created during statement parsing and execution. If you have problems with memory fragmentation, it might help to increase this a bit. This variable was added in MySQL 4.0.16.
Don't cache results that are larger than this number of bytes. The default value is 1MB. This variable was added in MySQL 4.0.1.
The minimum size for blocks allocated by the query cache. The default value is 4KB. Tuning information for this variable is given in Section 7.5.4.3, “Query Cache Configuration”. This variable is present from MySQL 4.1.
The amount of memory allocated for caching query results. The default value is
0, which disables the query cache. The allowable values are multiples of 1024; other values are rounded down to the nearest multiple. Note thatquery_cache_sizebytes of memory are allocated even ifquery_cache_typeis set to0. This variable was added in MySQL 4.0.1.The query cache needs a minimum size of about 40KB to allocate its structures. (The exact size depends on system architecture.) If you set the value of
query_cache_sizetoo small, you'll get a warning, as described in Section 7.5.4.3, “Query Cache Configuration”.Set the query cache type. Setting the
GLOBALvalue sets the type for all clients that connect thereafter. Individual clients can set theSESSIONvalue to affect their own use of the query cache.Option Description 0orOFFDon't cache results in or retrieve results from the query cache. Note that this does not deallocate the query cache buffer. To do that, you should set query_cache_sizeto 0.1orONCache all cacheable query results except for those that begin with SELECT SQL_NO_CACHE.2orDEMANDCache results only for cacheable queries that begin with SELECT SQL_CACHE.This variable defaults to
ON.Any unique prefix of a valid value may be used to set the value of this variable.
This variable was added in MySQL 4.0.3.
Normally, when one client acquires a
WRITElock on aMyISAMtable, other clients are not blocked from issuing statements that read from the table if the query results are present in the query cache. Setting this variable to 1 causes acquisition of aWRITElock for a table to invalidate any queries in the query cache that refer to the table. This forces other clients that attempt to access the table to wait while the lock is in effect. This variable was added in MySQL 4.0.19.The size of the persistent buffer used for statement parsing and execution. This buffer is not freed between statements. If you are running complex queries, a larger
query_prealloc_sizevalue might be helpful in improving performance, because it can reduce the need for the server to perform memory allocation during query execution operations.This variable was added in MySQL 4.0.16.
The size of blocks that are allocated when doing range optimization. This variable was added in MySQL 4.0.16.
Each thread that does a sequential scan allocates a buffer of this size (in bytes) for each table it scans. If you do many sequential scans, you might want to increase this value.
read_buffer_sizeandread_rnd_buffer_sizeare not specific to any storage engine and apply in a general manner for optimization. See Section 7.5.7, “How MySQL Uses Memory”, for example.Before MySQL 4.0.3, this variable was named
record_buffer.This variable is off by default. When it is enabled, the server allows no updates except from users that have the
SUPERprivilege or (on a slave server) from updates performed by slave threads. On a slave server, this can be useful to ensure that the slave accepts updates only from its master server and not from clients.read_onlyexists only as aGLOBALvariable, so changes to its value require theSUPERprivilege. Changes toread_onlyon a master server are not replicated to slave servers. The value can be set on a slave server independent of the setting on the master.This variable was added in MySQL 4.0.14.
When reading rows in sorted order following a key-sorting operation, the rows are read through this buffer to avoid disk seeks. See Section 7.2.9, “
ORDER BYOptimization”. Setting the variable to a large value can improveORDER BYperformance by a lot. However, this is a buffer allocated for each client, so you should not set the global variable to a large value. Instead, change the session variable only from within those clients that need to run large queries.read_buffer_sizeandread_rnd_buffer_sizeare not specific to any storage engine and apply in a general manner for optimization. See Section 7.5.7, “How MySQL Uses Memory”, for example.Before MySQL 4.0.3, this variable was named
record_rnd_buffer.Disables or enables automatic purging of relay log files as soon as they are not needed any more. The default value is 1 (
ON).The maximum amount of space to use for all relay logs.
Do not show databases for which the user has no database or table privileges. This can improve security if you are concerned about people being able to see what databases other users have. See also
skip_show_database.This variable was removed in MySQL 4.0.5. Beginning with this version, you should instead use the
SHOW DATABASESprivilege to control access by MySQL accounts to databases.If the MySQL server has been started with the
--secure-authoption, it blocks connections from all accounts that have passwords stored in the old (pre-4.1) format. In that case, the value of this variable isON, otherwise it isOFF.You should enable this option if you want to prevent all use of passwords in the old format (and hence insecure communication over the network). This variable was added in MySQL 4.1.1.
Server startup fails with an error if this option is enabled and the privilege tables are in pre-4.1 format.
The server ID, used in replication to give each master and slave a unique identity. This variable is set by the
--server-idoption. For each server participating in replication, you should pick a positive integer in the range from 1 to 232 – 1 to act as that server's ID.(Windows only.) Whether the server allows shared-memory connections. This variable was added in MySQL 4.1.1.
(Windows only.) The name of shared memory to use for shared-memory connections. This is useful when running multiple MySQL instances on a single physical machine. This variable was added in MySQL 4.1.0.
This is
OFFif mysqld uses external locking,ONif external locking is disabled. Before MySQL 4.0.3, this variable was namedskip_locking.This is
ONif the server allows only local (non-TCP/IP) connections. On Unix, local connections use a Unix socket file. On Windows, local connections use a named pipe or shared memory. On NetWare, only TCP/IP connections are supported, so do not set this variable toON. This variable can be set toONwith the--skip-networkingoption. This variable was added in MySQL 3.22.23.This prevents people from using the
SHOW DATABASESstatement if they do not have theSHOW DATABASESprivilege. This can improve security if you are concerned about people being able to see what databases other users have. See alsosafe_show_database. This variable was added in MySQL 3.23.4. As of MySQL 4.0.2, its effect also depends on theSHOW DATABASESprivilege: If the variable value isON, theSHOW DATABASESstatement is allowed only to users who have theSHOW DATABASESprivilege, and the statement displays all database names. If the value isOFF,SHOW DATABASESis allowed to all users, but displays each database name only if the user has theSHOW DATABASESprivilege or some privilege for the database. Note that any global privilege is a privilege for the database.If creating a thread takes longer than this many seconds, the server increments the
Slow_launch_threadsstatus variable. This variable was added in MySQL 3.23.15.On Unix platforms, this variable is the name of the socket file that is used for local client connections. The default is
/tmp/mysql.sock. (For some distribution formats, the directory might be different, such as/var/lib/mysqlfor RPMs.)On Windows, this variable is the name of the named pipe that is used for local client connections. The default value is
MySQL(not case sensitive).Each thread that needs to do a sort allocates a buffer of this size. Increase this value for faster
ORDER BYorGROUP BYoperations. See Section A.1.4.4, “Where MySQL Stores Temporary Files”.The current server SQL mode. This variable was added in MySQL 3.23.41. It can be set dynamically as of MySQL 4.1.1. See Section 5.1.7, “Server SQL Modes”.
The maximum number of rows to return from
SELECTstatements. The default value for a new connection is the maximum number of rows that the server allows per table, which depends on the server configuration and may be affected if the server build was configured with--with-big-tables. Typical default values are (232)–1 or (264)–1. If you have changed the limit, the default value can be restored by assigning a value ofDEFAULT.If a
SELECThas aLIMITclause, theLIMITtakes precedence over the value ofsql_select_limit.sql_select_limitdoes not apply toSELECTstatements executed within stored routines. It also does not apply toSELECTstatements that do not produce a result set to be returned to the client. These includeSELECTstatements in subqueries,CREATE TABLE ... SELECT, andINSERT INTO ... SELECT.This variable is a synonym for
table_type. It was added in MySQL 4.1.2.If this variable is set to 1, when any nontemporary table is created its
.frmfile is synchronized to disk (usingfdatasync()). This is slower but safer in case of a crash. The default is 1. This was added as a command-line option in MySQL 4.0.18. It is also a settable global variable as of MySQL 4.1.3.The server system time zone. When the server begins executing, it inherits a time zone setting from the machine defaults, possibly modified by the environment of the account used for running the server or the startup script. The value is used to set
system_time_zone. Typically the time zone is specified by theTZenvironment variable. It also can be specified using the--timezoneoption of the mysqld_safe script.The
system_time_zonevariable differs fromtime_zone. Although they might have the same value, the latter variable is used to initialize the time zone for each client that connects. See Section 9.7, “MySQL Server Time Zone Support”.system_time_zonewas added in MySQL 4.1.3.The number of open tables for all threads. Increasing this value increases the number of file descriptors that mysqld requires. You can check whether you need to increase the table cache by checking the
Opened_tablesstatus variable. See Section 5.1.6, “Server Status Variables”. If the value ofOpened_tablesis large and you do not doFLUSH TABLESoften (which just forces all tables to be closed and reopened), then you should increase the value of thetable_cachevariable. For more information about the table cache, see Section 7.4.7, “How MySQL Opens and Closes Tables”.The default table type (storage engine). To set the table type at server startup, use the
--default-table-typeoption. This variable was added in MySQL 3.23.0. See Section 5.1.2, “Server Command Options”.How many threads the server should cache for reuse. When a client disconnects, the client's threads are put in the cache if there are fewer than
thread_cache_sizethreads there. Requests for threads are satisfied by reusing threads taken from the cache if possible, and only when the cache is empty is a new thread created. This variable can be increased to improve performance if you have a lot of new connections. (Normally, this doesn't provide a notable performance improvement if you have a good thread implementation.) By examining the difference between theConnectionsandThreads_createdstatus variables, you can see how efficient the thread cache is. For details, see Section 5.1.6, “Server Status Variables”. This variable was added in MySQL 3.23.16.This variable is specific to Solaris systems, for which mysqld invokes the
thr_setconcurrency()with the variable value. This function enables applications to give the threads system a hint about the desired number of threads that should be run at the same time. This variable was added in MySQL 3.23.7.The stack size for each thread. Many of the limits detected by the
crash-metest are dependent on this value. The default is large enough for normal operation. See Section 7.1.4, “The MySQL Benchmark Suite”. The default is 64KB before MySQL 4.0.10 and 192KB thereafter. If the thread stack size is too small, it limits the complexity of the SQL statements that the server can handle, the recursion depth of stored procedures, and other memory-consuming actions.This variable is unused.
The current time zone. This variable is used to initialize the time zone for each client that connects. By default, the initial value of this is
'SYSTEM'(which means, “use the value ofsystem_time_zone”). The value can be specified explicitly at server startup with the--default-time-zoneoption. See Section 9.7, “MySQL Server Time Zone Support”. This variable was added in MySQL 4.1.3.The time zone for the server. This is set from the
TZenvironment variable when mysqld is started. The time zone also can be set by giving a--timezoneargument to mysqld_safe. This variable was added in MySQL 3.23.15. As of MySQL 4.1.3, it is obsolete and has been replaced by thesystem_time_zonevariable. See Section A.1.4.6, “Time Zone Problems”.The maximum size of internal in-memory temporary tables. (The actual limit is determined as the smaller of
max_heap_table_sizeandtmp_table_size.) If an in-memory temporary table exceeds the limit, MySQL automatically converts it to an on-diskMyISAMtable. Increase the value oftmp_table_size(andmax_heap_table_sizeif necessary) if you do many advancedGROUP BYqueries and you have lots of memory. This variable does not apply to user-createdMEMORYtables.The directory used for temporary files and temporary tables. Starting from MySQL 4.1, this variable can be set to a list of several paths that are used in round-robin fashion. Paths should be separated by colon characters (“
:”) on Unix and semicolon characters (“;”) on Windows, NetWare, and OS/2.The multiple-directory feature can be used to spread the load between several physical disks. If the MySQL server is acting as a replication slave, you should not set
tmpdirto point to a directory on a memory-based file system or to a directory that is cleared when the server host restarts. A replication slave needs some of its temporary files to survive a machine restart so that it can replicate temporary tables orLOAD DATA INFILEoperations. If files in the temporary file directory are lost when the server restarts, replication fails. However, if you are using MySQL 4.0.0 or later, you can set the slave's temporary directory using theslave_load_tmpdirvariable. In that case, the slave won't use the generaltmpdirvalue and you can settmpdirto a nonpermanent location.This variable was added in MySQL 3.22.4.
The amount in bytes by which to increase a per-transaction memory pool which needs memory. See the description of
transaction_prealloc_size. This variable was added in MySQL 4.0.16.There is a per-transaction memory pool from which various transaction-related allocations take memory. The initial size of the pool in bytes is
transaction_prealloc_size. For every allocation that cannot be satisfied from the pool because it has insufficient memory available, the pool is increased bytransaction_alloc_block_sizebytes. When the transaction ends, the pool is truncated totransaction_prealloc_sizebytes.By making
transaction_prealloc_sizesufficiently large to contain all statements within a single transaction, you can avoid manymalloc()calls. This variable was added in MySQL 4.0.16.The default transaction isolation level. This variable was added in MySQL 4.0.3.
This variable is set by the
SET TRANSACTION ISOLATION LEVELstatement. See Section 12.4.6, “SET TRANSACTIONSyntax”. If you settx_isolationdirectly to an isolation level name that contains a space, the name should be enclosed within quotes, with the space replaced by a dash. For example:SET tx_isolation = 'READ-COMMITTED';
Any unique prefix of a valid value may be used to set the value of this variable.
The version number for the server.
The
BDBstorage engine version. This variable was added in MySQL 3.23.31 with the namebdb_versionand renamed toversion_bdbin MySQL 4.1.1.The configure script has a
--with-commentoption that allows a comment to be specified when building MySQL. This variable contains the value of that comment. This variable was added in MySQL 4.0.17.The type of machine or architecture on which MySQL was built. This variable was added in MySQL 4.1.1.
The type of operating system on which MySQL was built. This variable was added in MySQL 4.0.19.
The number of seconds the server waits for activity on a noninteractive connection before closing it. This timeout applies only to TCP/IP and Unix socket file connections, not to connections made via named pipes, or shared memory.
On thread startup, the session
wait_timeoutvalue is initialized from the globalwait_timeoutvalue or from the globalinteractive_timeoutvalue, depending on the type of client (as defined by theCLIENT_INTERACTIVEconnect option tomysql_real_connect()). See alsointeractive_timeout.
MySQL Enterprise Expert use of server system variables is part of the service offered by the MySQL Enterprise Monitor. To subscribe, see http://www.mysql.com/products/enterprise/advisors.html.
Several system variables exist only as session variables. These
cannot be set at server startup but can be assigned values at
runtime using the
SET
statement (except for those that are read only). Most of them are
not displayed by SHOW VARIABLES,
but you can obtain their values using
SELECT. This section describes the
session system variables. For information about setting or
displaying their values, see
Section 5.1.5, “Using System Variables”. For example:
mysql> SELECT @@autocommit;
+--------------+
| @@autocommit |
+--------------+
| 1 |
+--------------+
The lettercase of these variables does not matter.
The following table lists the system variables that have only session scope:
Table 5.2. mysqld Session System Variable Summary
| Name | Cmd-Line | Option file | System Var | Dynamic |
|---|---|---|---|---|
| autocommit | Yes | Yes | ||
| big-tables | Yes | Yes | ||
| - Variable: big_tables | Yes | Yes | ||
| error_count | Yes | No | ||
| foreign_key_checks | Yes | Yes | ||
| identity | Yes | Yes | ||
| insert_id | Yes | Yes | ||
| last_insert_id | Yes | Yes | ||
| rand_seed1 | Yes | Yes | ||
| rand_seed2 | Yes | Yes | ||
| sql_auto_is_null | Yes | Yes | ||
| sql_big_tables | Yes | Yes | ||
| sql_buffer_result | Yes | Yes | ||
| sql_log_bin | Yes | Yes | ||
| sql_log_off | Yes | Yes | ||
| sql_log_update | Yes | Yes | ||
| sql_notes | Yes | Yes | ||
| sql_quote_show_create | Yes | Yes | ||
| sql_safe_updates | Yes | Yes | ||
| sql_warnings | Yes | Yes | ||
| timestamp | Yes | Yes | ||
| unique_checks | Yes | Yes | ||
| warning_count | Yes | No |
The autocommit mode. If set to 1, all changes to a table take effect immediately. If set to 0, you must use
COMMITto accept a transaction orROLLBACKto cancel it. By default, client connections begin withautocommitset to 1. If you changeautocommitmode from 0 to 1, MySQL performs an automaticCOMMITof any open transaction. Another way to begin a transaction is to use aSTART TRANSACTIONorBEGINstatement. See Section 12.4.1, “START TRANSACTION,COMMIT, andROLLBACKSyntax”.If set to 1, all temporary tables are stored on disk rather than in memory. This is a little slower, but the error
The tabledoes not occur fortbl_nameis fullSELECToperations that require a large temporary table. The default value for a new connection is 0 (use in-memory temporary tables). As of MySQL 4.0, you should normally never need to set this variable, because MySQL automatically converts in-memory tables to disk-based tables as necessary.Note
This variable was formerly named
sql_big_tables.The number of errors that resulted from the last statement that generated messages. This variable is read only. See Section 12.5.5.11, “
SHOW ERRORSSyntax”.This variable was added in MySQL 4.1.0.
If set to 1 (the default), foreign key constraints for
InnoDBtables are checked. If set to 0, they are ignored. Disabling foreign key checking can be useful for reloadingInnoDBtables in an order different from that required by their parent/child relationships. This variable was added in MySQL 3.23.52. See Section 13.2.5.4, “FOREIGN KEYConstraints”.Setting
foreign_key_checksto 0 also affects data definition statements:DROP DATABASEdrops a database even if it contains tables that have foreign keys that are referred to by tables outside the database, andDROP TABLEdrops tables that have foreign keys that are referred to by other tables.Note
Setting
foreign_key_checksto 1 does not trigger a scan of the existing table data. Therefore, rows added to the table whileforeign_key_checks = 0will not be verified for consistency.This variable is a synonym for the
last_insert_idvariable. It exists for compatibility with other database systems. As of MySQL 3.23.25, you can read its value withSELECT @@identity. As of MySQL 4.0.3, you can also set its value withSET identity.The value to be used by the following
INSERTorALTER TABLEstatement when inserting anAUTO_INCREMENTvalue. This is mainly used with the binary log.The value to be returned from
LAST_INSERT_ID(). This is