Database connection Error: Error 1040 (HY000): Too Many connections 1. View the number of connections
host -u root-p123456 Status
This command returns several values for the current state of MySQLuptime:18869 threads:1 questions:1 Slow queries:0 opens:33 Flush tables:1 c:0 queries per second avg:0. theUptime: Is the time when MySQL is running normally. Threads: Refers to the number of open sessions. Questions: Number of Customer questions (queries) since the server started (should be as long as you interact with MySQL: Whether you query the table or query server status). Slow queries: by literal meaning is slow query meaning, do not know musql think how long is enough to calculate as long query, this first put. Opens: Number of database tables that have been opened by the serverFlush Tables: The number of flush ..., refresh, and reload commands that the server has performed. Open Tables: The number of tables that are used by the database by command, starting with server startup. Queries per second Avg:select statement average query time? 2. Change the number of connections to the configuration fileThe configuration file typically exists location:/etc/my.cnfModify Entry: Increase Max_connections (maximum number of connections) and wait_timeout (Connection wait time) under [mysqld]
[Mysqld]max_connections=5000wait_timeout=5
3. Stop and start the serviceTo stop the MySQL service:
/usr/local/mysql/bin/mysqladmin shutdown-uroot-p123456
To start the MySQL service:
/usr/local/bin/mysqld_safe--defaults-file=/etc/my.cnf--user=root
Description:--defaults-file for the specified configuration file--user user name for login to MySQL 4. After restarting successfully, log in to MySQL to kill connection numbergo to command line:./mysql-uroot-p123456To View connection information:mysql> show processlist;The host column is so connected to the information, ID for the corresponding identity, can kill offmysql> kill 1;
MySQL connection number too many error 1040 (HY000): Too Many connections