Problem with script (5.0.18 on 6.1-PRE)

James Long list at
Mon Feb 27 20:24:40 PST 2006

I'm migrating a system from MySQL 3.x to 5.0.18 on a server running 
"6.1-PRERELEASE FreeBSD 6.1-PRERELEASE #0: Wed Feb 22 08:53:15 PST 2006".

With no mysql running:

www : 19:42:23 /usr/local/etc/rc.d# ps -axl | grep mysql
www : 19:42:33 /usr/local/etc/rc.d# 

And the following defined:

www : 19:42:33 /usr/local/etc/rc.d# egrep "debug|mysql" /etc/rc.conf

When I:

www : 19:42:49 /usr/local/etc/rc.d# /usr/local/etc/rc.d/ start

I see:

/usr/local/etc/rc.d/ DEBUG: Sourcing /etc/defaults/rc.conf
/usr/local/etc/rc.d/ DEBUG: checkyesno: mysql_enable is set to YES.
/usr/local/etc/rc.d/ DEBUG: pid file (/var/db/mysql/ not readable.
/usr/local/etc/rc.d/ DEBUG: run_rc_command: evaluating mysql_prestart().
/usr/local/etc/rc.d/ DEBUG: checkyesno: mysql_limits is set to NO.
Starting mysql.
/usr/local/etc/rc.d/ DEBUG: run_rc_command: _doit: su -m mysql -c 'sh -c "/usr/local/bin/mysqld_safe  --defaults-extra-file=/var/db/mysql/my.cnf --user=mysql --datadir=/var/db/mysql --pid-file=/var/db/mysql/ --bind-address=localhost > /dev/null &"'
www : 19:43:38 /usr/local/etc/rc.d#

So then I:

www : 19:43:45 /usr/local/etc/rc.d# ps -axl | grep mysql

and I see:

www : 19:43:50 /usr/local/etc/rc.d#

IOW, MySQL doesn't start.

If I manually run the object of the su command:

www : 19:47:46 /usr/local/etc/rc.d# sh -c "/usr/local/bin/mysqld_safe  --defaults-extra-file=/var/db/mysql/my.cnf --user=mysql --datadir=/var/db/mysql --pid-file=/var/db/mysql/ --bind-address=localhost > /dev/null &"

And then do:

www : 19:47:58 /usr/local/etc/rc.d# ps -axl | grep mysql

I see:

root  16826  0.0  0.2  1708  1160  p0  S     7:47PM   0:00.01 /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/ --bind-address=localhost
mysql 16849  0.0  4.8 57584 24916  p0  S     7:47PM   0:00.12 /usr/local/libexec/mysqld --defaults-extra-file=/var/db/mysql/my.cnf --basedir=/usr/local --datadir=/var/db/mysql --user=mysql --pid-file=/var/db/mysql/ --bind-address=localhost
www : 19:48:03 /usr/local/etc/rc.d#

IOW, running the "sh -c ..." command manually works, although it leave 
mysqld_safe running as root, instead of as the mysql user (which does

/etc/passwd:mysql:*:88:88:MySQL Daemon:/nonexistent:/sbin/nologin

If I manually run the command under su to try to get the service to run
under the mysql user account, mysql does not start, and neither su nor
mysql leave any error messages on either the console or the logs:

www : 19:55:21 /usr/local/etc/rc.d# su -m mysql -c 'sh -c "/usr/local/bin/mysqld_safe  --defaults-extra-file=/var/db/mysql/my.cnf --user=mysql --datadir=/var/db/mysql --pid-file=/var/db/mysql/ --bind-address=localhost > /dev/null &"'
www : 19:56:48 /usr/local/etc/rc.d# findps mysql
www : 19:56:52 /usr/local/etc/rc.d# su -m mysql -c 'sh -c "/usr/local/bin/mysqld_safe  --defaults-extra-file=/var/db/mysql/my.cnf --user=mysql --datadir=/var/db/mysql --pid-file=/var/db/mysql/ --bind-address=localhost > /dev/null &"'
www : 19:57:01 /usr/local/etc/rc.d# findps mysql
www : 19:57:04 /usr/local/etc/rc.d#

(findps is an alias that basically does a ps -axl | grep "$1" | grep -v grep)

How can I fix this, or get su to tell me more about why the command works
manually as root, but not under su as mysql?



More information about the freebsd-questions mailing list