mysql貌似因爲連接數太大而連接不上,根據網上的教程,寫份查詢連接數命令的總結

先是要進入到mysql的命令行,

然後執行語句

查詢最大可連接數

show variables like '%max_connections%';

查詢一下當前的連接數

show processlist;

或者這條語句也同樣可以查詢

show status like 'Threads%';

這裏面的Threads_connected即爲連接數。

-------------------------------------------------------------------------------

(單行線內的內容,唔,未必需要看)

而其他的參數

Threads_cached 在使用手冊上的解釋是

The number of threads in the thread cache.
This variable is not meaningful in the embedded server (libmysqld) and as of MySQL 5.7.2 is no
longer visible within the embedded server.

譯爲

線程緩存中的連接數.

這個參數在嵌入式服務器(libmysqld )中沒有意義,而從mysql 5.7.2開始在嵌入式服務器內這個參數就不再存在(唔,應該是這個意思)

 

Threads_connected 

The number of currently open connections.

譯爲
當前打開的連接數

 

Theads_created  

The number of threads created to handle connections. If Threads_created is big, you may
want to increase the thread_cache_size value. The cache miss rate can be calculated as
Threads_created/Connections.

這個數量代表着:爲了處理鏈接,創建的線程有多少條。如果這個數量很大,你可以去增加thread_cache_size的值.這個緩存丟失率等於 Threads_created除以Connections.

 

Thread_running 

The number of threads that are not sleeping.

並未處於休眠狀態的線程數量。

---------------------------------------------------------------------------------

如果運行中的數量很大的話,可以將數據庫可運行數量增大,或者直接重啓數據庫。

如果是linux下的話

service mysqld restart
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章