13.5.4.21.SHOWVARIABLES語法
13.5.4.21. SHOW
VARIABLES語法
SHOW [GLOBAL | SESSION] VARIABLES [LIKE 'pattern']
SHOW VARIABLES顯示了部門MySQL系統變量的值。本信息也可以使用mysqladmin variables命令獲得。
使用GLOBAL選項,您可以獲得被用于MySQL新連接的值。使用SESSION,您可以得到對于當前連接起效的值。如果您兩個選項都不使用,默認值為SESSION。
LOCAL是SESSION的同義詞。
如果默認值不合適,當mysqld啟動時或在SET語句運行過程中,您可以使用命令行選項設置多數的這類變量。請參見5.3.1節,“mysqld命令行選項”和13.5.3節,“SET語法。
此處顯示了部分的輸出。對于您的服務器,變量和值的清單會有所不同。在5.3.3節,“服務器系統變量”中給出了每個變量的意義。在7.5.2節,“調節服務器參數”中提供了有關調整變量的信息。
mysql> SHOW VARIABLES;
+---------------------------------+-----------------------------------------------+
| Variable_name | Value |
+---------------------------------+-----------------------------------------------+
| auto_increment_increment | 1 |
| auto_increment_offset | 1 |
| automatic_sp_privileges | ON |
| back_log | 50 |
| basedir | /home/jon/bin/mysql-5.1/ |
| binlog_cache_size | 32768 |
| bulk_insert_buffer_size | 8388608 |
| character_set_client | latin1 |
| character_set_connection | latin1 |
... ...
| max_user_connections | 0 |
| max_write_lock_count | 4294967295 |
| multi_range_count | 256 |
| myisam_data_pointer_size | 6 |
| myisam_max_sort_file_size | 2147483647 |
| myisam_recover_options | OFF |
| myisam_repair_threads | 1 |
| myisam_sort_buffer_size | 8388608 |
| ndb_autoincrement_prefetch_sz | 32 |
| ndb_cache_check_time | 0 |
| ndb_force_send | ON |
... ... ...
| time_zone | SYSTEM |
| timed_mutexes | OFF |
| tmp_table_size | 33554432 |
| tmpdir | |
| transaction_alloc_block_size | 8192 |
| transaction_prealloc_size | 4096 |
| tx_isolation | REPEATABLE-READ |
| updatable_views_with_limit | YES |
| version | 5.1.2-alpha-log |
| version_comment | Source distribution |
| version_compile_machine | i686 |
| version_compile_os | suse-linux |
| wait_timeout | 28800 |
+---------------------------------+-----------------------------------------------+
使用LIKE子句,本語句只顯示與樣式相匹配的變量:
mysql> SHOW VARIABLES LIKE 'have%';
+-----------------------+----------+
| Variable_name | Value |
+-----------------------+----------+
| have_archive | YES |
| have_bdb | NO |
| have_blackhole_engine | YES |
| have_compress | YES |
| have_crypt | YES |
| have_csv | YES |
| have_example_engine | NO |
| have_federated_engine | NO |
| have_geometry | YES |
| have_innodb | YES |
| have_isam | NO |
| have_ndbcluster | DISABLED |
| have_openssl | NO |
| have_partition_engine | YES |
| have_query_cache | YES |
| have_raid | NO |
| have_rtree_keys | YES |
| have_symlink | YES |
+-----------------------+----------+