重慶思莊技術(shù)分享——mysql show status和show variables區(qū)別
mysql show status和show variables區(qū)別
show status查看系統(tǒng)運(yùn)行的實(shí)時(shí)狀態(tài),便于dba查看mysql當(dāng)前運(yùn)行的狀態(tài),做出相應(yīng)優(yōu)化,動態(tài)的,不可認(rèn)為修改,只能系統(tǒng)自動update。
如:
--查看MySQL本次啟動后的運(yùn)行時(shí)間(單位:秒)
show status like 'uptime';
--查看select語句的執(zhí)行數(shù)
show [global] status like 'com_select';
--查看insert語句的執(zhí)行數(shù)
show [global] status like 'com_insert';
--查看update語句的執(zhí)行數(shù)
show [global] status like 'com_update';
--查看delete語句的執(zhí)行數(shù)
show [global] status like 'com_delete';
show variables
show variables查看系統(tǒng)參數(shù),系統(tǒng)默認(rèn)設(shè)置或者dba調(diào)整優(yōu)化后的參數(shù),靜態(tài)的??梢酝ㄟ^set或者修改my.cnf配置文件修改。
如:
MariaDB [(none)]> show variables like '%conn%';
+--------------------------+-----------------+
| Variable_name? ?? ?? ?? ?| Value? ?? ?? ???|
+--------------------------+-----------------+
| character_set_connection | utf8? ?? ?? ?? ?|
| collation_connection? ???| utf8_general_ci |
| connect_timeout? ?? ?? ? | 10? ?? ?? ?? ???|? ? ---連接數(shù)超時(shí)時(shí)間
| extra_max_connections? ? | 1? ?? ?? ?? ?? ?|? ? ---額外的最大連接數(shù)
| init_connect? ?? ?? ?? ? |? ?? ?? ?? ?? ???|
| max_connect_errors? ?? ? | 10? ?? ?? ?? ???|? ? ---允許客戶端最大的錯(cuò)誤連接數(shù)
| max_connections? ?? ?? ? | 1500? ?? ?? ?? ?|? ? ---最大連接數(shù)
| max_user_connections? ???| 0? ?? ?? ?? ?? ?|
+--------------------------+-----------------+