输入banner图图片脚本导航/分类

mysql 清理command为sleep的连接进程

> SELECT concat(KILL ,id,;) FROM information_schema.processlist WHERE user=user1; mysql> select concat(KILL ,id,;) from information_schema.processlist where user=root into outfile /tmp/a.txt; mysql> source /tmp/a.txt;

其中上面root用户是“show processlist;” 命令下,User列对应最多的Sleep进程连接状态的用户。

:如上面导出为指定文件路径报“ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement”错误。

技术图片

 

 是由于MySQL在文件的导入、导出有个默认的文件路径。通过“show variables like ‘%secure%‘;”命令查看默认导入、导出文件路径。

技术图片

 

从上面可看出默认路径为“/var/lib/mysql-files/”;所以改下导出文件路径:

mysql> SELECT concat(KILL ,id,;) FROM information_schema.processlist WHERE user=root into outfile /var/lib/mysql-files/a.txt;

然后在执行“source /var/lib/mysql-files/a.txt;”命令,接下来是出现一堆“Query OK, 0 rows affected (0.00 sec)”,执行成功。

 

mysql 清理command为sleep的连接进程

标签:int   导入   lazy   roc   rom   mamicode   --   cut   where