mysql5.7出现大量too many connections及too many open files错误,且配置最大连接数未生效
too many connections是由于mysql配置中连接数过少,不足以支撑当前的并发数,too many open files是由于mysql open_files_limit的值大小不够。 最开始mysql日志出现的错误为too many connections,mysql配置文件已经配置了最大连接数max_connections=2000,登录到mysql中,查看mysql连接收:show processlist; (查看详细执行信息使用:show full processlist;),发现线程数只有500多,并没有达到配置文件中的最大配置,登录mysql查看其生效的最大连接数及mysql open_files_limit mysql> show variables like '%max_connections%'; +-----------------+-------+ | Variable_name | Value | +-----------------+-------+ | max_connections | 214 | +-----------------+-------+ 1 row in set (0.00 sec) mysql> show variables like '%open_files_limit%'; +------------------+