If you are making too many database connections then you will get error “too many database connections”, to resolve this error you can manually terminate database connections.
Most quick and easy ways to terminate or kill MySQL connections is to restart MySQL services. You can use below command to restart MySQL service:
But if you want to kill particular connection then you have to follow below steps. For that you have to use MySQL client and you can simply use MySQL command for that.
Now you can use Mysql query to check process list.
Most quick and easy ways to terminate or kill MySQL connections is to restart MySQL services. You can use below command to restart MySQL service:
Code:
/scripts/restartsrv_mysql
Code:
Mysql
Code:
Mysql> SHOW PROCESSLIST;
+-----+------+-----------------+------+---------+------+-------+---------------+
| Id | User | Host | db | Command | Time | State | Info |
+-----+------+-----------------+------+---------+------+-------+----------------+
| 222 | root | localhost:61199 | hoststud | Query | 0 | init | SHOW PROCESSLIST |
| 333 | root | localhost:23543 | hoststud | Sleep | 10 | | NULL |
+-----+------+-----------------+------+---------+------+-------+----------------+
2 rows in set (0.00 sec)
mysql> KILL 222;
Query OK, 0 rows affected (0.00 sec)