我只想知道如何關閉mysql的所有打開連接,並且它會提高我的網站的速度。如何使用codeigniter關閉mysql中的開放連接
請看看mysql的狀態輸出的
Variable_name Value
Aborted_connects 1
Connection_errors_accept 0
Connection_errors_internal 0
Connection_errors_max_connections 0
Connection_errors_peer_address 0
Connection_errors_select 0
Connection_errors_tcpwrap 0
Connections 252
Max_used_connections 6
Performance_schema_session_connect_attrs_lost 0
Ssl_client_connects 0
Ssl_connect_renegotiates 0
Ssl_finished_connects 0
Threads_connected 1
我在database.php中
$active_group = 'default';
$query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'root',
'password' => '#######',
'database' => '#######',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
您的輸出狀態只顯示一個'Threads_connected'。如果你擔心'連接'統計不是。這是MySQL服務器的連接嘗試次數(成功與否)。換句話說,252個連接嘗試中只有一個當前連接。如果這是一個手機通話記錄,這意味着你有252個電話,一個仍在進行中。 – DFriend