show variables like 'max_connections';  #默认保留一个连接给管理员,所以最大连接数为215
show global status like 'Max_used_connections'; #当前连接和程序连接

image.png

可以通过配置文件修改连接数

修改

/etc/mysql/my.cnf中[mysqld]下增加
interactive_timeout=600
wait_timeout=600
max_connections = 3000


常见错误:

pymysql.err.OperationalError: (1040, u'Too many connections')