Marcin Polewski wrote:
On my machine, I start the following command:
/bin/sh /usr/local/bin/mysqld_safe
--defaults-extra-file=/var/db/mysql/my.cnf --user=mysql
--datadir=/var/db/mysql --pid-file=/var/db/mysql/zigzu.bixbots.com.pid

For some reason my PID file does not contain the parent PID, instead it
contains one the children's PID. So when I attempt to stop MySQL, it stops
only one of the child mysqld processes and not all of them.

For example, when mysqld_safe starts up, the following PIDs are running:

23349 mysqld_safe
+ 23378    mysqld
--snip--
+ 23567    mysqld
+ 24078    mysqld

But the PID file will contain 23383 which is not the parent process.

How can I resolve this?

By using the correct way to shut down the server? :)

mysqladmin -u root -p shutdown

If you don't want to put your password in the clear within a script, you can use something like expect (http://expect.nist.gov/), or put the password for MySQL's root within ~/.my.cnf for the OS user you are running the script as.

I certainly don't recommend killing the server (well, depends on the situation and kill level I guess, but I have to say this up front). Also, if you're running under mysqld_safe, mysqld will simply be restarted by that process should it go down (by killing it or not), so you would also have to kill mysqld_safe first.

Further, the above looks like you are running under LinuxThreads, which actually shows threads as processes within ps etc. - so the above are not processes, but threads. If you switch to NPTL (Native Posix Threading Library) within Linux, you will actually see the single mysqld process (along with the single mysqld_safe process).

You can tell what you are running with 'getconf GNU_LIBPTHREAD_VERSION', to switch to NPTL 'export LD_ASSUME_KERNEL=2.6.9', to switch back to LinuxThreads 'export LD_ASSUME_KERNEL 2.4.19'.

I'd be interested in seeing if that stores the right PID for you whilst running under NPTL.

Best regards

Mark

--
Mark Leith
MySQL Regional Support Manager, Americas
Sun Microsystems, Inc., http://www.sun.com/mysql/

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to