杀死mysqld进程 [英] Killing the mysqld process

查看:126
本文介绍了杀死mysqld进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个约有800K行的表。我运行一个更新用户设置hash = SHA1(CONCAT({约八个字段}))其中1;



现在我有一个悬挂Sequel Pro过程,我不确定 mysqld 过程。



这是两个问题:


  1. 从杀死这些程序?我正在使用一个单独的数据库,所以不会对系统上的其他数据库造成损害,对吗?


  2. 假设你必须更新这样的表。

  3. >我刚刚用phpMyAdmin检查,它出现,好像查询完成。我仍然有Sequel Pro使用100%的两个我的核心虽然...

    解决方案

    如果你使用InnoDB



    最简单的终止叛变的方法是在一个事务日志的支持下进行恢复和回滚的目的,然后你可以逃避很多,特别是在非生产环境。查询是使用MySQL shell作为root用户:

      SHOW PROCESSLIST; 

    这将提供当前连接和每个连接的进程ID的列表。要终止任何给定的查询,例如数字19,请使用:

      KILL 19; 

    通常,这将撤销和回滚查询。在某些情况下,这是不够的,您可能必须用 kill -9 强制退出MySQL服务器进程。在大多数情况下,您应该可以立即重新启动服务器,数据库将处于上次完全提交状态。


    I have a table with ~800k rows. I ran an update users set hash = SHA1(CONCAT({about eight fields})) where 1;

    Now I have a hung Sequel Pro process and I'm not sure about the mysqld process.

    This is two questions:

    1. What harm can possibly come from killing these programs? I'm working on a separate database, so no damage should come to other databases on the system, right?

    2. Assume you had to update a table like this. What would be a quicker / more reliable method of updating without writing a separate script.

    I just checked with phpMyAdmin and it appears as though the query is complete. I still have Sequel Pro using 100% of both my cores though...

    解决方案

    If you're using InnoDB, which is backed by a transaction log for recovery and rollback purposes, then you can get away with a lot, especially in a non-production environment.

    The easiest way to terminate a renegade query is to use the MySQL shell as the root user:

    SHOW PROCESSLIST;
    

    This will give you a list of the current connections and a process ID for each one. To terminate any given query, such as number 19, use:

    KILL 19;
    

    Usually this will undo and roll back the query. In some cases this is not sufficient and you may have to force-quit the MySQL server process with kill -9. Under most circumstances you should be able to restart the server right away, and the DB will be in the last fully committed state.

    这篇关于杀死mysqld进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆