Chinaunix

标题: 杀死mysqld进程问题 [打印本页]

作者: ipigzhu    时间: 2020-12-24 14:03
标题: 杀死mysqld进程问题
MySQL提供的启停脚本里面,用杀死mysqld进程停止mysql的

  'stop')
    # Stop daemon. We use a signal here to avoid having to know the
    # root password.

    if test -s "$mysqld_pid_file_path"
    then
      # signal mysqld_safe that it needs to stop
      touch "$mysqld_pid_file_path.shutdown"

      mysqld_pid=`cat "$mysqld_pid_file_path"`

      if (kill -0 $mysqld_pid 2>/dev/null)
      then
        echo $echo_n "Shutting down MySQL"
        kill $mysqld_pid
        # mysqld should remove the pid file when it exits, so wait for it.
        wait_for_pid removed "$mysqld_pid" "$mysqld_pid_file_path"; return_value=$?
      else
        log_failure_msg "MySQL server process #$mysqld_pid is not running!"
        rm "$mysqld_pid_file_path"
      fi




为什么我自己kill mysqlpid 无法杀死msyqld进程,它会重新生成,杀不死呢???



作者: seesea2517    时间: 2020-12-25 16:32
按道理 mysqld 是响应 kill 命令的,你可以看看这个链接:
https://dev.mysql.com/doc/refman ... ent-signal-response

杀掉又重启的现象,你看看是不是有 mysqld_safe 进程在。
作者: ipigzhu    时间: 2021-01-29 10:04
回复 2# seesea2517

我看了下它写的mysqld_safe脚本
它需要删除  rm -f /var/lock/subsys/mysql  这个文件才可以




我试了一下,是这样的~~~

作者: seesea2517    时间: 2021-01-29 14:17
回复 3# ipigzhu

原来如此,感谢分享~





欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2