mysql shutdown and kill
--mysqladmin shutdown
If you execute mysqladmin shutdown when connecting to a local server using a Unix socket file, mysqladminwaits until the server's process ID file has been removed, to ensure that the server has stopped properly.
KILL
Syntax
KILL [CONNECTION | QUERY] thread_id
Each connection to mysqld runs in a separate thread. You can see which threads are running with the SHOW PROCESSLIST
statement and kill a thread with the KILL
statement.thread_id
KILL
permits an optional CONNECTION
or QUERY
modifier:
KILL CONNECTION
is the same asKILL
with no modifier: It terminates the connection associated with the giventhread_id
.KILL QUERY
terminates the statement that the connection is currently executing, but leaves the connection itself intact.
If you have the PROCESS
privilege, you can see all threads. If you have the SUPER
privilege, you can kill all threads and statements. Otherwise, you can see and kill only your own threads and statements.
You can also use the mysqladmin processlist and mysqladmin kill commands to examine and kill threads.
You cannot use KILL
with the Embedded MySQL Server library because the embedded server merely runs inside the threads of the host application. It does not create any connection threads of its own.
When you use KILL
, a thread-specific kill flag is set for the thread. In most cases, it might take some time for the thread to die because the kill flag is checked only at specific intervals:
In
SELECT
,ORDER BY
andGROUP BY
loops, the flag is checked after reading a block of rows. If the kill flag is set, the statement is aborted.During
ALTER TABLE
, the kill flag is checked before each block of rows are read from the original table. If the kill flag was set, the statement is aborted and the temporary table is deleted.During
UPDATE
orDELETE
operations, the kill flag is checked after each block read and after each updated or deleted row. If the kill flag is set, the statement is aborted. Note that if you are not using transactions, the changes are not rolled back.GET_LOCK()
aborts and returnsNULL
.An
INSERT DELAYED
thread quickly flushes (inserts) all rows it has in memory and then terminates.If the thread is in the table lock handler (state:
Locked
), the table lock is quickly aborted.If the thread is waiting for free disk space in a write call, the write is aborted with a “disk full” error message.
- Warning
Killing a
REPAIR TABLE
orOPTIMIZE TABLE
operation on aMyISAM
table results in a table that is corrupted and unusable. Any reads or writes to such a table fail until you optimize or repair it again (without interruption).
mysql shutdown and kill的更多相关文章
- mysql root用户kill connection报ERROR 1095 (HY000): You are not owner of thread N
今日某系统mysql root用户kill connection时报ERROR 1095 (HY000): You are not owner of thread N 按说通过root用户具有supe ...
- xampp启动MySQL出现Error: MySQL shutdown unexpectedly.
20175227张雪莹 2018-2019-2 <Java程序设计> xampp启动MySQL出现Error: MySQL shutdown unexpectedly. 问题 本周在学习教 ...
- 黄聪:xampp运行MySQL shutdown unexpectedly解决方案
相信不少喜欢WordPress的朋友和我一样,会用xampp在本地搭建一个网站学习调试,但是在用的过程中也会遇到些麻烦,毕竟我们都是小白,今天就分享一个xampp运行MySQL数据时出现 Error: ...
- MySQL 循环执行kill语句杀掉连接
mysql中创建索引时,一直卡住不动,刚开始以为可能是数据量太大导致的,可是一直等了很久还是一样没有反应,看来操作的表被锁住了,执行show processlist 果然发现有大量的lock,使用ki ...
- mysql 杀掉(kill) lock进程脚本
杀掉lock进程最快的方法是重启mysql,像你这种情况,1000多sql锁住了,最好是重启如果不允许重启,我提供一个shell脚本,生成 kill id命令杀掉lock线程,如下:--------- ...
- MySQL连接线程kill利器之pt-kill
如何每10秒检查一次,杀死指定用户超过100秒的查询? pt-kill \ --no-version-check \ --host 127.0.0.1 --port 3306 --user 'xxxx ...
- 显示mysql线程和kill线程的命令
show processlist;//显示哪些线程正在运行. kill id //kill线程 通常在表被锁的时候用. show processlist;显示哪些线程正在运行.您也可以使用my ...
- xampp运行MySQL shutdown unexpectedly解决方案
昨天晚上自己的网站突然打不开了,以为被人黑了.想想不应该啊,这小站不会有人关注的,于是登录服务器看了下,发现是Mysql打不开了 很奇怪,因为今天白天还是可以打开的,下班后也没有碰过服务器 首先看看是 ...
- MySQL Session--批量KILL会话
使用SELECT INTO OUTFILE+SOURCE批量KILL ## 查看kill_id文件是否存在 SYSTEM cat /tmp/kill_id.sql ## 如果文件存在,则先删除 sys ...
随机推荐
- 一级缓存二级缓存(hibernate)
缓存是介于应用程序和物理数据源之间,其作用是为了降低应用程序对物理数据源访问的频次,从而提高了应用的运行性能.缓存内的数据是对物理数据源中的数据的复制,应用程序在运行时从缓存读写数据,在特定的时刻或事 ...
- centos7安装图形化界面
yum groups install -y "GNOME Desktop" "Graphical Administration Tools"
- P1280 尼克的任务
题目描述 尼克每天上班之前都连接上英特网,接收他的上司发来的邮件,这些邮件包含了尼克主管的部门当天要完成的全部任务,每个任务由一个开始时刻与一个持续时间构成. 尼克的一个工作日为N分钟,从第一分钟开始 ...
- lvs讲解
作者写的就是好呀,简单明了,安逸的我也不知道早点看看,非得等到找工作了,在这里临时抱佛脚,以后再过来添加我自己的总结 http://www.linuxvirtualserver.org/zh/
- mongoDB 学习笔记纯干货(mongoose、增删改查、聚合、索引、连接、备份与恢复、监控等等)
最后更新时间:2017-07-13 11:10:49 原始文章链接:http://www.lovebxm.com/2017/07/13/mongodb_primer/ MongoDB - 简介 官网: ...
- .NetCore~TagHelpers标签的使用
回到目录 TagHelpers 能够让服务端代码参与创建和渲染 HTML 元素,让整个View视图看起来只有Html代码,也让前台开发人员开发的页面直接被后台开发人员使用,而不需要重复的书写代码,这种 ...
- [POJ2104/HDU2665]Kth Number-主席树-可持久化线段树
Problem Kth Number Solution 裸的主席树,模板题.但是求k大的时候需要非常注意,很多容易写错的地方.卡了好久.写到最后还给我来个卡空间. 具体做法参见主席树论文<可持久 ...
- C++第一篇--类的引入
C++第一篇--类的引入 1. 用C语言输出两个人的信息 Person1.c:通过字符实现 #include <stdio.h> int main(int argc,int **argv) ...
- app耗电优化之二 使用电源管理来安排任务
PowerManager 电源管理(电源使用管理).主要管理设备启动,保持活动,休眠,唤醒.其中为了保持任务,提供了PowerManager.WakeLock(唤醒锁).执行任务时持有这个唤醒锁,就可 ...
- hdu_1564: Play a game
题目链接 看n的奇偶性,题解参见kuangbin的博客 http://www.cnblogs.com/kuangbin/archive/2013/07/22/3204654.html #include ...