mysql
mysql

Reputation: 11

How to close existing connection in MySQL

I found that some connection got unclosed after the execution of command from Mysql server.

How can I configure my Mysql server so that I can close them all after executing a command?

Upvotes: 1

Views: 9325

Answers (2)

Packet Tracer
Packet Tracer

Reputation: 3924

if you can get the process_id inside mysql you can kill the process. Killing any process should work (though it will create a new connection next time you send a command).

mysql> SHOW PROCESSLIST; -- or SHOW FULL PROCESSLIST
mysql> KILL process_number;

Upvotes: 4

Maxim Krizhanovsky
Maxim Krizhanovsky

Reputation: 26749

Configure the wait_timeout variable to something soon enough, for example 30 seconds

Upvotes: 1

Related Questions