Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Feb 2006 20:24:30 -0800
From:      James Long <list@museum.rain.com>
To:        freebsd-questions@freebsd.org
Subject:   Problem with mysql-server.sh script (5.0.18 on 6.1-PRE)
Message-ID:  <20060228042430.GA17894@ns.museum.rain.com>

next in thread | raw e-mail | index | archive | help
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
mysql_enable="YES"
mysql_args="--bind-address=localhost"
rc_debug="ON"
#mysql_enable="NO"

When I:

www : 19:42:49 /usr/local/etc/rc.d# /usr/local/etc/rc.d/mysql-server.sh start

I see:

/usr/local/etc/rc.d/mysql-server.sh: DEBUG: Sourcing /etc/defaults/rc.conf
/usr/local/etc/rc.d/mysql-server.sh: DEBUG: checkyesno: mysql_enable is set to YES.
/usr/local/etc/rc.d/mysql-server.sh: DEBUG: pid file (/var/db/mysql/www.vehiclenet.com.pid): not readable.
/usr/local/etc/rc.d/mysql-server.sh: DEBUG: run_rc_command: evaluating mysql_prestart().
/usr/local/etc/rc.d/mysql-server.sh: DEBUG: checkyesno: mysql_limits is set to NO.
Starting mysql.
/usr/local/etc/rc.d/mysql-server.sh: 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/www.vehiclenet.com.pid --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/www.vehiclenet.com.pid --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/www.vehiclenet.com.pid --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/www.vehiclenet.com.pid --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
exist).

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


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/www.vehiclenet.com.pid --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/www.vehiclenet.com.pid --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?


Thanks!

Jim




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060228042430.GA17894>