mysqlのToo many connectionsエラーについて
mysqlはデフォルトで最大接続数が100に設定されている。
それを越えると接続エラーとなる。(以下はcakephpが出したエラー)
2014-07-21 11:06:09 Warning: Warning (2): mysql_connect() [<a href='http://php.net/function.mysql-connect'>function.mysql-connect</a>]: Too many connections in [CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 374] 2014-07-21 11:06:09 Warning: Warning (2): mysql_select_db(): supplied argument is not a valid MySQL-Link resource in [CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 379] 2014-07-21 11:06:09 Warning: Warning (2): mysql_query(): supplied argument is not a valid MySQL-Link resource in [CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 411] 2014-07-21 11:06:09 Warning: Warning (2): mysql_get_server_info(): supplied argument is not a valid MySQL-Link resource in [CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 387]
確認方法
mysql> show global variables like '%max_connection%'; +-----------------+-------+ | Variable_name | Value | +-----------------+-------+ | max_connections | 100 | +-----------------+-------+ 1 row in set (0.01 sec)
変更方法
vi /etc/my.cnf [mysqld] max_connections=200