mysql> show status like ‘Threads%‘ -> ; +-------------------+-------+ | Variable_name | Value | +-------------------+-------+ | Threads_cached | 7 | | Threads_connected | 16 | ##这个数值指的是打开的连接数 | Threads_created | 812 | | Threads_running | 2 | ##这个数值指的是激活的连接数 +-------------------+-------+ 4 rows in set mysql> show variables like ‘%max_connections%‘; +------------------------+-------+ | Variable_name | Value | +------------------------+-------+ | max_connections | 1000 | 这是当前设置的最大连接数 | mysqlx_max_connections | 1000 | +------------------------+-------+ 2 rows in set
可以在/etc/my.cnf里面设置数据库的最大连接数 max_connections = 1000