mysql> show GLOBAL VARIABLES LIKE "max_%"; +----------------------------+----------------------+ | Variable_name | Value | +----------------------------+----------------------+ | max_allowed_packet | 16777216 | | max_binlog_cache_size | 18446744073709547520 | | max_binlog_size | 1073741824 | | max_binlog_stmt_cache_size | 18446744073709547520 | | max_connect_errors | 10 | | max_connections | 500 | | max_delayed_threads | 20 | | max_error_count | 64 | | max_heap_table_size | 16777216 | | max_insert_delayed_threads | 20 | | max_join_size | 18446744073709551615 | | max_length_for_sort_data | 1024 | | max_long_data_size | 16777216 | | max_prepared_stmt_count | 16382 | | max_relay_log_size | 0 | | max_seeks_for_key | 18446744073709551615 | | max_sort_length | 1024 | | max_sp_recursion_depth | 0 | | max_tmp_tables | 32 | | max_user_connections | 0 | | max_write_lock_count | 18446744073709551615 | +----------------------------+----------------------+
起動している間に、最高どこまでコネクションされたか。
mysql> show status like 'Max%'; +----------------------+-------+ | Variable_name | Value | +----------------------+-------+ | Max_used_connections | 186 | +----------------------+-------+ 1 row in set (0.01 sec)
現在のコネクション数。
mysql> show status like 'Threads_connected%'; +-------------------+-------+ | Variable_name | Value | +-------------------+-------+ | Threads_connected | 63 | +-------------------+-------+ 1 row in set (0.00 sec)
Apache側でエラーが出る。
# more /var/log/httpd/error_log [Fri Feb 22 05:00:49 2013] [error] [client 111.111.111.111] PDO Connection Error: SQLSTATE[08004] [1040] Too many connections
mysql> set global max_connections=450;