The server quit without updating pid file

- (2008-11-23) [1765] Dialects of English and Unix - (2008-08-21) [1733] memcached - overview, installation, example of use in PHP - (2008-08-02) [1700] FTP server on Fedora Linux - (2008-07-06) [1633] Changing a screen saver from a web page (PHP, Perl, OSX) - (2008-05-06) [1553] Automatic startup and shutdown of Tomcat - (2008-02-24) [1288] Linux run states, shell special commands, and directory structures - (2007-08-03) [1028] Linux / Unix - process priority and nice - (2007-01-10) [544] Repeating tasks with crontab - (2005-12-27)A167 - Web Application Deployment - Shell Programming (bash) [4587] shell - bash.

the server quit without updating pid file-77the server quit without updating pid file-1

Not sure why, which frightens me, but I'm working from a cruise boat with a poor connection and the important thing was to fix it.

Trying to restart: A quick trip to Google took me on to a couple of articles - which described different problems, or OS Specific things.

- the seedy side of election campaigning Trans Atlantic crossing - the starter Moving from mysql to mysqli - simple worked example People in New York Link to page ...

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page This is a page archived from The Horse's Mouth at - the diary and writings of Graham Ellis.

So, the procedure of moving My SQL databases to a "larger disk" on a system with SELinux on described below.

Ok, I did it on a virtual machine, so my box is: VMWare Workstation 7.1.5 Cent OS 6.2 (x64) My SQL 5.5.21 I assume you want to move My SQL databases from its default location (/var/lib/mysql) to another disk mounted to /data, such that you new datadir would be /data/mysql So start your terminal and type shell commands (# - preceeds my comments, shell cp -rp /var/lib/mysql /data #Create by coping from some of the sample files provided with My SQL installation #I took "huge", you can take any one whichever suites your situation best: shell vi /etc/my.cnf) by fixing paths for socket file and adding datadir option into [mysqld] section and fixing . My SQL is not running, but lock file (/var/lock/subsys/mysql) exists #Error log is not updated at all ?

It's confused into thinkig it should be referring to a PID file which didn't exist, and because it's crashed, it's refusing to restart. Ensure that /etc/contains: And restart the server as this will overstep the problem above, and also recover the databases; error recovery levels of 1 or 2 are likely to let you recover (almost) everything we're told, and I have the previous good backup anyway, so I can restore if I need to.

And it's not got any process to tidy us if I try to run server stop scripts. Then stop the server once it's forced the recovery, remove the innodb_force_recovery assignment, and restart it. I'm monitoring carefully, and posting this to my blog partly as a test and partly in the hope it may provide a helpful clue to others in the future.

" fi ;; 'restart') # Stop the service and regardless of whether it was # running or not, start it again. 在shell中用于获取最后运行的后台Process的PID,具体在本例中,是mysqld_safe进程的pid。 因为第一个参数是created,所以会执行test -s "$pid_file_path" && i='' && break命令。 -s file 如果文件的长度不为零,则为真 该命令的意思是如果pid文件存在,则将变量i设置为空,并退出while循环。 然后执行如下判断, 如果$i为空,则打印成功日志,并退出脚本,很显然,在pid文件存在的情况下,会将变量i设置为空。 再来看看pid文件不存在的情况 首先,会判断$pid是否不为空(即if test -n "$pid") 如果不为空,则代表在执行完mysqld_safe后,已经捕捉到了该进程的pid。 在这种情况下,进一步通过kill -0 "$pid"确认该进程是否存在。 kill -0就是不发送任何信号,但是系统会进行错误检查,所以经常用来检查一个进程是否存在,当进程不存在时, kill -0 pid会返回错误 如果该进程存在,则不执行任何操作,直接跳到如下操作 将变量i加1,并sleep 1s。 然后,继续while循环,之所以这样做,是考虑到mysqld_safe已经执行,但是mysqld实例还在启动过程中,还没创建好pid文件。 一直到

Ok, I did it on a virtual machine, so my box is: VMWare Workstation 7.1.5 Cent OS 6.2 (x64) My SQL 5.5.21 I assume you want to move My SQL databases from its default location (/var/lib/mysql) to another disk mounted to /data, such that you new datadir would be /data/mysql So start your terminal and type shell commands (# - preceeds my comments, shell cp -rp /var/lib/mysql /data #Create by coping from some of the sample files provided with My SQL installation #I took "huge", you can take any one whichever suites your situation best: shell vi /etc/my.cnf) by fixing paths for socket file and adding datadir option into [mysqld] section and fixing . My SQL is not running, but lock file (/var/lock/subsys/mysql) exists #Error log is not updated at all ?It's confused into thinkig it should be referring to a PID file which didn't exist, and because it's crashed, it's refusing to restart. Ensure that /etc/contains: And restart the server as this will overstep the problem above, and also recover the databases; error recovery levels of 1 or 2 are likely to let you recover (almost) everything we're told, and I have the previous good backup anyway, so I can restore if I need to.And it's not got any process to tidy us if I try to run server stop scripts. Then stop the server once it's forced the recovery, remove the innodb_force_recovery assignment, and restart it. I'm monitoring carefully, and posting this to my blog partly as a test and partly in the hope it may provide a helpful clue to others in the future." fi ;; 'restart') # Stop the service and regardless of whether it was # running or not, start it again. 在shell中用于获取最后运行的后台Process的PID,具体在本例中,是mysqld_safe进程的pid。 因为第一个参数是created,所以会执行test -s "$pid_file_path" && i='' && break命令。 -s file 如果文件的长度不为零,则为真 该命令的意思是如果pid文件存在,则将变量i设置为空,并退出while循环。 然后执行如下判断, 如果$i为空,则打印成功日志,并退出脚本,很显然,在pid文件存在的情况下,会将变量i设置为空。 再来看看pid文件不存在的情况 首先,会判断$pid是否不为空(即if test -n "$pid") 如果不为空,则代表在执行完mysqld_safe后,已经捕捉到了该进程的pid。 在这种情况下,进一步通过kill -0 "$pid"确认该进程是否存在。 kill -0就是不发送任何信号,但是系统会进行错误检查,所以经常用来检查一个进程是否存在,当进程不存在时, kill -0 pid会返回错误 如果该进程存在,则不执行任何操作,直接跳到如下操作 将变量i加1,并sleep 1s。 然后,继续while循环,之所以这样做,是考虑到mysqld_safe已经执行,但是mysqld实例还在启动过程中,还没创建好pid文件。 一直到$1达到$service_startup_timeout定义的时长。 如果在while循环的过程中,通过kill -0 "$pid"判断到进程已经不存在了, 则会再判断一次,如果这次判断的结果依旧是pid file不存在,且进程不存在,则会执行 log_failure_msg "The server quit without updating PID file ($pid_file_path)." 这就是大名鼎鼎的“The server quit without updating PID file”的由来。 然后,调用wait_for_pid函数进行判断,其实,wait_for_pid函数中设置avoid_race_condition变量的目的是为了stop选项,确实有可能出现,mysqld是在检查pid file之后,检查进程是否存活之前退出的。 如果mysqld进程没有正常运行,在会打印“My SQL server process #$mysqld_pid is not running!if $0 stop $other_args; then $0 start $other_args else log_failure_msg "Failed to stop running server, so refusing to try to start." exit 1 fi ;; 'reload'|'force-reload') if test -s "$mysqld_pid_file_path" ; then read mysqld_pid /dev/null ; then log_success_msg "My SQL running ($mysqld_pid)" exit 0 else log_failure_msg "My SQL is not running, but PID file exists" exit 1 fi else # Try to find appropriate mysqld process mysqld_pid=`pidof $libexecdir/mysqld` # test if multiple pids exist pid_count=`echo $mysqld_pid | wc -w` if test $pid_count -gt 1 ; then log_failure_msg "Multiple My SQL running but PID file could not be found ($mysqld_pid)" exit 5 elif test -z $mysqld_pid ; then if test -f "$lock_file_path" ; then log_failure_msg "My SQL is not running, but lock file ($lock_file_path) exists" exit 2 fi log_failure_msg "My SQL is not running" exit 3 else log_failure_msg "My SQL is running but PID file could not be found" exit 4 fi fi ;; *) # usage basename=`basename "$0"` echo "Usage: $basename [ My SQL server options ]" exit 1 ;; esac exit 0 首先,它判断当前路径下的bin目录中是否存在该可执行文件,如果不存在,则再判断$bindir(通常指的是$basedir/bin)目录下是否存在。 如果还是没有,则会判断/etc/my.cnf是否存在并且可读,如果是,则判断该配置文件中是否指定了basedir参数, 如果指定了,则取出该参数的值,并判断该值对应的目录中是否存在bin/my_print_defaults可执行文件 最后一步,如果在上述目录中实在没发现my_print_defaults文件, 索性就将print_defaults设置为"my_print_defaults",寄希望于该命令在当前的PATH环境中。 -z string 判断字符串是否为空 如果--pid-file没有在读取到的配置文件中设置或者脚本刚开始的mysqld_pid_file_path参数没有设置, 则pid file默认设置在datadir下,以主机名.pid命名。 如果该参数设置了,还需要进一步判断 如果该参数中带有斜杠,则代表给定的值带有路径,可直接使用。 如果该参数中没带路径,则代表给定的值只是pid的文件名,可将其设在datadir下。 &1 &命令,启动mysqld实例。 注意到没有,mysqld_safe其实是在basedir中执行的,包括mysql初始化脚本mysql_install_db,也建议在basedir中执行,具体可参考: 分析Maria DB初始化脚本mysql_install_db 然后通过wait_for_pid函数进行判断,具体可见下文对于wait_for_pid函数的分析 判断完毕后, 查看$lockdir目录是否可写,可写的话,则在目录上创建一个文件。 在利用mysqld_safe启动mysql实例后,会调用该参数 wait_for_pid created "$! ”信息,并删除pid文件。 如果在执行stop的时候,判断pid文件的长度为0,则会打印"My SQL server PID file could not be found! Mysql won't start from the preference pane of the terminal.

||

Ok, I did it on a virtual machine, so my box is: VMWare Workstation 7.1.5 Cent OS 6.2 (x64) My SQL 5.5.21 I assume you want to move My SQL databases from its default location (/var/lib/mysql) to another disk mounted to /data, such that you new datadir would be /data/mysql So start your terminal and type shell commands (# - preceeds my comments, shell cp -rp /var/lib/mysql /data #Create by coping from some of the sample files provided with My SQL installation #I took "huge", you can take any one whichever suites your situation best: shell vi /etc/my.cnf) by fixing paths for socket file and adding datadir option into [mysqld] section and fixing . My SQL is not running, but lock file (/var/lock/subsys/mysql) exists #Error log is not updated at all ?

It's confused into thinkig it should be referring to a PID file which didn't exist, and because it's crashed, it's refusing to restart. Ensure that /etc/contains: And restart the server as this will overstep the problem above, and also recover the databases; error recovery levels of 1 or 2 are likely to let you recover (almost) everything we're told, and I have the previous good backup anyway, so I can restore if I need to.

And it's not got any process to tidy us if I try to run server stop scripts. Then stop the server once it's forced the recovery, remove the innodb_force_recovery assignment, and restart it. I'm monitoring carefully, and posting this to my blog partly as a test and partly in the hope it may provide a helpful clue to others in the future.

" fi ;; 'restart') # Stop the service and regardless of whether it was # running or not, start it again. 在shell中用于获取最后运行的后台Process的PID,具体在本例中,是mysqld_safe进程的pid。 因为第一个参数是created,所以会执行test -s "$pid_file_path" && i='' && break命令。 -s file 如果文件的长度不为零,则为真 该命令的意思是如果pid文件存在,则将变量i设置为空,并退出while循环。 然后执行如下判断, 如果$i为空,则打印成功日志,并退出脚本,很显然,在pid文件存在的情况下,会将变量i设置为空。 再来看看pid文件不存在的情况 首先,会判断$pid是否不为空(即if test -n "$pid") 如果不为空,则代表在执行完mysqld_safe后,已经捕捉到了该进程的pid。 在这种情况下,进一步通过kill -0 "$pid"确认该进程是否存在。 kill -0就是不发送任何信号,但是系统会进行错误检查,所以经常用来检查一个进程是否存在,当进程不存在时, kill -0 pid会返回错误 如果该进程存在,则不执行任何操作,直接跳到如下操作 将变量i加1,并sleep 1s。 然后,继续while循环,之所以这样做,是考虑到mysqld_safe已经执行,但是mysqld实例还在启动过程中,还没创建好pid文件。 一直到$1达到$service_startup_timeout定义的时长。 如果在while循环的过程中,通过kill -0 "$pid"判断到进程已经不存在了, 则会再判断一次,如果这次判断的结果依旧是pid file不存在,且进程不存在,则会执行 log_failure_msg "The server quit without updating PID file ($pid_file_path)." 这就是大名鼎鼎的“The server quit without updating PID file”的由来。 然后,调用wait_for_pid函数进行判断,其实,wait_for_pid函数中设置avoid_race_condition变量的目的是为了stop选项,确实有可能出现,mysqld是在检查pid file之后,检查进程是否存活之前退出的。 如果mysqld进程没有正常运行,在会打印“My SQL server process #$mysqld_pid is not running!

if $0 stop $other_args; then $0 start $other_args else log_failure_msg "Failed to stop running server, so refusing to try to start." exit 1 fi ;; 'reload'|'force-reload') if test -s "$mysqld_pid_file_path" ; then read mysqld_pid /dev/null ; then log_success_msg "My SQL running ($mysqld_pid)" exit 0 else log_failure_msg "My SQL is not running, but PID file exists" exit 1 fi else # Try to find appropriate mysqld process mysqld_pid=`pidof $libexecdir/mysqld` # test if multiple pids exist pid_count=`echo $mysqld_pid | wc -w` if test $pid_count -gt 1 ; then log_failure_msg "Multiple My SQL running but PID file could not be found ($mysqld_pid)" exit 5 elif test -z $mysqld_pid ; then if test -f "$lock_file_path" ; then log_failure_msg "My SQL is not running, but lock file ($lock_file_path) exists" exit 2 fi log_failure_msg "My SQL is not running" exit 3 else log_failure_msg "My SQL is running but PID file could not be found" exit 4 fi fi ;; *) # usage basename=`basename "$0"` echo "Usage: $basename [ My SQL server options ]" exit 1 ;; esac exit 0 首先,它判断当前路径下的bin目录中是否存在该可执行文件,如果不存在,则再判断$bindir(通常指的是$basedir/bin)目录下是否存在。 如果还是没有,则会判断/etc/my.cnf是否存在并且可读,如果是,则判断该配置文件中是否指定了basedir参数, 如果指定了,则取出该参数的值,并判断该值对应的目录中是否存在bin/my_print_defaults可执行文件 最后一步,如果在上述目录中实在没发现my_print_defaults文件, 索性就将print_defaults设置为"my_print_defaults",寄希望于该命令在当前的PATH环境中。 -z string 判断字符串是否为空 如果--pid-file没有在读取到的配置文件中设置或者脚本刚开始的mysqld_pid_file_path参数没有设置, 则pid file默认设置在datadir下,以主机名.pid命名。 如果该参数设置了,还需要进一步判断 如果该参数中带有斜杠,则代表给定的值带有路径,可直接使用。 如果该参数中没带路径,则代表给定的值只是pid的文件名,可将其设在datadir下。 &1 &命令,启动mysqld实例。 注意到没有,mysqld_safe其实是在basedir中执行的,包括mysql初始化脚本mysql_install_db,也建议在basedir中执行,具体可参考: 分析Maria DB初始化脚本mysql_install_db 然后通过wait_for_pid函数进行判断,具体可见下文对于wait_for_pid函数的分析 判断完毕后, 查看$lockdir目录是否可写,可写的话,则在目录上创建一个文件。 在利用mysqld_safe启动mysql实例后,会调用该参数 wait_for_pid created "$! ”信息,并删除pid文件。 如果在执行stop的时候,判断pid文件的长度为0,则会打印"My SQL server PID file could not be found!

Mysql won't start from the preference pane of the terminal.

||

Ok, I did it on a virtual machine, so my box is: VMWare Workstation 7.1.5 Cent OS 6.2 (x64) My SQL 5.5.21 I assume you want to move My SQL databases from its default location (/var/lib/mysql) to another disk mounted to /data, such that you new datadir would be /data/mysql So start your terminal and type shell commands (# - preceeds my comments, shell cp -rp /var/lib/mysql /data #Create by coping from some of the sample files provided with My SQL installation #I took "huge", you can take any one whichever suites your situation best: shell vi /etc/my.cnf) by fixing paths for socket file and adding datadir option into [mysqld] section and fixing . My SQL is not running, but lock file (/var/lock/subsys/mysql) exists #Error log is not updated at all ?

It's confused into thinkig it should be referring to a PID file which didn't exist, and because it's crashed, it's refusing to restart. Ensure that /etc/contains: And restart the server as this will overstep the problem above, and also recover the databases; error recovery levels of 1 or 2 are likely to let you recover (almost) everything we're told, and I have the previous good backup anyway, so I can restore if I need to.

And it's not got any process to tidy us if I try to run server stop scripts. Then stop the server once it's forced the recovery, remove the innodb_force_recovery assignment, and restart it. I'm monitoring carefully, and posting this to my blog partly as a test and partly in the hope it may provide a helpful clue to others in the future.

" fi ;; 'restart') # Stop the service and regardless of whether it was # running or not, start it again. 在shell中用于获取最后运行的后台Process的PID,具体在本例中,是mysqld_safe进程的pid。 因为第一个参数是created,所以会执行test -s "$pid_file_path" && i='' && break命令。 -s file 如果文件的长度不为零,则为真 该命令的意思是如果pid文件存在,则将变量i设置为空,并退出while循环。 然后执行如下判断, 如果$i为空,则打印成功日志,并退出脚本,很显然,在pid文件存在的情况下,会将变量i设置为空。 再来看看pid文件不存在的情况 首先,会判断$pid是否不为空(即if test -n "$pid") 如果不为空,则代表在执行完mysqld_safe后,已经捕捉到了该进程的pid。 在这种情况下,进一步通过kill -0 "$pid"确认该进程是否存在。 kill -0就是不发送任何信号,但是系统会进行错误检查,所以经常用来检查一个进程是否存在,当进程不存在时, kill -0 pid会返回错误 如果该进程存在,则不执行任何操作,直接跳到如下操作 将变量i加1,并sleep 1s。 然后,继续while循环,之所以这样做,是考虑到mysqld_safe已经执行,但是mysqld实例还在启动过程中,还没创建好pid文件。 一直到$1达到$service_startup_timeout定义的时长。 如果在while循环的过程中,通过kill -0 "$pid"判断到进程已经不存在了, 则会再判断一次,如果这次判断的结果依旧是pid file不存在,且进程不存在,则会执行 log_failure_msg "The server quit without updating PID file ($pid_file_path)." 这就是大名鼎鼎的“The server quit without updating PID file”的由来。 然后,调用wait_for_pid函数进行判断,其实,wait_for_pid函数中设置avoid_race_condition变量的目的是为了stop选项,确实有可能出现,mysqld是在检查pid file之后,检查进程是否存活之前退出的。 如果mysqld进程没有正常运行,在会打印“My SQL server process #$mysqld_pid is not running!

达到$service_startup_timeout定义的时长。 如果在while循环的过程中,通过kill -0 "$pid"判断到进程已经不存在了, 则会再判断一次,如果这次判断的结果依旧是pid file不存在,且进程不存在,则会执行 log_failure_msg "The server quit without updating PID file ($pid_file_path)." 这就是大名鼎鼎的“The server quit without updating PID file”的由来。 然后,调用wait_for_pid函数进行判断,其实,wait_for_pid函数中设置avoid_race_condition变量的目的是为了stop选项,确实有可能出现,mysqld是在检查pid file之后,检查进程是否存活之前退出的。 如果mysqld进程没有正常运行,在会打印“My SQL server process #$mysqld_pid is not running!

Tags: , ,