I. Find out which SQL command is currently being executed by MySQL
Then find out the ID of the statement to terminate
Mysql> Kill ID Number
ID of >mysqladmin-uroot-p123456 kill to kill when not logged in
You can also write it to a file
Not logged in case >mysql-e ' show full processlist; ' > 111.txt;
Two. current MySQL status;
Mysql>show status;
Last line
Threads_connected refers to the current number of connections; Do not like to set the maximum number of connections: Mysql>set GLOBAL max_connections= connections; Let it take effect mysql>flush privileges;
or modify the max_connections in/ETC/MY.CNF and restart
Note In the configuration file:
Set-variable=max_user_connections=30 This is the number of single-user connections
set-variable=max_connections=800 This is the global limit number of connections
Kill all currently executing SQL commands
1. Under the Processlist table below the INFORMATION_SCHEMA library, you can list the SQL that is being executed
Mysql> Select Concat (' KILL ', id, '; ') from information_schema.processlist where user= ' root ';
+------------------------+
| Concat (' KILL ', id, '; ') |
+------------------------+
| KILL 3101; |
| KILL 2946; |
+------------------------+
2 rows in Set (0.00 sec)
2. We can then export it to a file under the external file system;
Mysql>select concat (' KILL ', id, '; ') from information_schema.processlist where user= ' root ' into outfile '/tmp/a.txt ';
Query OK, 2 rows Affected (0.00 sec)
3.source come in, the file is finally executed.
mysql>source/tmp/a.txt;
Query OK, 0 rows Affected (0.00 sec)
MySQL Service common commands