Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 18833

Summary: starting mysql fails in checkconfig() / version 3.23.56
Product: Gentoo Linux Reporter: Russ Tennant <russ>
Component: [OLD] ServerAssignee: Gentoo Linux MySQL bugs team <mysql-bugs>
Status: VERIFIED FIXED    
Severity: normal CC: rac, robbat2, woodchip
Priority: High    
Version: unspecified   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Russ Tennant 2003-04-05 21:06:43 UTC
The following code does not match "datadir=/var/lib/mysql" 
 
 
        dir=`awk '{ if ( $0 ~ /^datadir[ \t]+=/ ) { print $3 } }' < /etc/mysql/my.cnf` 
 
        if [ ! -d $dir/mysql ] ; then 
               eerror "You dont appear to have the mysql database installed yet." 
               eerror "Please run /usr/bin/mysql_install_db to have this done..." 
               return 1 
        fi 
 

Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1 Robert Coie (RETIRED) gentoo-dev 2003-04-07 19:59:24 UTC
Method and I talked about this on IRC, and he came up with the following:

awk -F = '{ if ( $0 ~ /^datadir/ ) { sub(/[ \t]/,"",$2); print $2 } }' < /etc/mysql/my.cnf
 
Comment 2 Donny Davies (RETIRED) gentoo-dev 2003-04-07 20:07:07 UTC
fine.  either that or this will do:

my_print_defaults mysqld | grep -- --datadir | sed -e "s|^.*=\(.*\)|\1|"

i like the way this mysql-bugs thing is working out.  more eyes on these little bugs means they'll get atention quicker.

but go for it, you found the fix first ;-)

Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2003-04-07 21:42:51 UTC
which of the two solutions would be better?
I think the method with piping in the conf file would be better, as under some cases if your conf file contains errors, my_print_defaults won't work.

yup, this mysql-bugs works out well.
as does php-bugs.
Comment 4 Russ Tennant 2003-04-08 01:46:25 UTC
The sed script (#2) looks like it works. I don't think other awk script (#1) takes into consideration the case where there is whitespace before the variable name:

[\s]+datadir=/var/lib/mysql



Comment 5 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2003-04-22 05:04:22 UTC
fixed in CVS.
Change applied to both mysql4 and mysql3 init scripts.

I've put it in as a bugfix, as that is what it really is, so no version bump.
Comment 6 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2003-08-12 01:34:19 UTC
Closing old bugs.