Step1)顯示全域變數
mysql> SHOW GLOBAL VARIABLES\G;
************ 1. row **************
Variable_name: activate_all_roles_on_login
Value: OFF
************ 2. row **************
Variable_name: admin_address
Value:
************ 3. row *************
Variable_name: admin_port
Value: 33062
Step2)顯示個別全域變數
SHOW GLOBAL VARIABLES LIKE 'local_infile';
+---------------+-------------------+
| Variable_name | Value |
+---------------+-------------------+
| local_infile | OFF |
+---------------+-------------------+
1 row in set (0.00 sec)
Step3)顯示max開頭的全域變數
show global variables like 'max%';
+--------------------------------------+----------------------+
| Variable_name | Value |
+--------------------------------------+----------------------+
| max_allowed_packet | 67108864 |
| max_binlog_cache_size | 18446744073709547520 |
| max_binlog_size | 104857600 |
| max_binlog_stmt_cache_size | 18446744073709547520 |
| max_connect_errors | 100 |
| max_connections | 1000 |
Step4)設定全域變數
SET GLOBAL max_connections = 1000;
Step5)查詢用戶端連線狀態
show processlist;
+-------+-----------------+-----------------+------+---------+--------+------------------------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+-------+-----------------+-----------------+------+---------+--------+------------------------+------------------+
| 5 | event_scheduler | localhost | NULL | Daemon | 221718 | Waiting on empty queue | NULL |
| 9 | dmoj | localhost:60620 | dmoj | Sleep | 7 | | NULL |
| 19530 | root | localhost | NULL | Query | 0 | init | show processlist |
+-------+-----------------+-----------------+------+---------+--------+------------------------+------------------+