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/5.7/en/unix-signal-response.html#client-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

原来如此,感谢分享~
页: [1]
查看完整版本: 杀死mysqld进程问题