Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 110553 - mysql config ignores datadir
Summary: mysql config ignores datadir
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux MySQL bugs team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-26 08:46 UTC by Neil Katin
Modified: 2005-10-27 15:23 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Neil Katin 2005-10-26 08:46:38 UTC
I upgraded mysql from 4.0.25 to 4.1.14 today, and noticed
a problem.

I use a non-default datadir instead of the default /var/lib/mysql.
In once place in the ebuild file the assigned datadir is ignored:
it is hard coded to /var/lib/mysql.

The same problem exists in the 4.1.15 and 5.0.x ebuilds.

The problem is in the pkg_config() section just before the root password
is being assigned (around line 585).  The existing code is:

    local mysqld="${ROOT}/usr/sbin/mysqld \
        ${options} \
        --skip-grant-tables \
        --basedir=${ROOT}/usr \
        --datadir=${ROOT}/var/lib/mysql \
        --skip-innodb \
        --skip-bdb \
        --max_allowed_packet=8M \
        --net_buffer_length=16K \
        --socket=${socket} \
        --pid-file=${ROOT}/var/run/mysqld/mysqld.pid"

The code needs to non hard-code the datadir:

    local mysqld="${ROOT}/usr/sbin/mysqld \
        ${options} \
        --skip-grant-tables \
        --basedir=${ROOT}/usr \
        --datadir=${DATADIR} \
        --skip-innodb \
        --skip-bdb \
        --max_allowed_packet=8M \
        --net_buffer_length=16K \
        --socket=${socket} \
        --pid-file=${ROOT}/var/run/mysqld/mysqld.pid"

---------------------------------------

Two other minor comments:

In this same function both ${DATADIR} and ${ROOT}/${DATADIR}
are used.  I suspect that DATADIR is what is wanted, but in
any case it should be consistent.

Also, in theory DATADIR could have spaces or other metacharacters,
but it is never quoted.  This is a bug waiting to happen.
Comment 1 Francesco R. (RETIRED) gentoo-dev 2005-10-26 15:16:27 UTC
AFAIK It's not possible to hard code the datadir, that's a mere default.

Try to 
#diff /usr/portage/dev-db/mysql/files/mysql-4.0.24-r2.rc6 /etc/init.d/mysql
or check that the /etc/mysql/my.cnf has the following:

[mysqld]
datadir = /your/path/

If the issue is still not evident, please reopen the bug
Comment 2 Neil Katin 2005-10-26 21:45:29 UTC
I'm sorry if the original bug wasn't clear.

I set datadir in /etc/mysql/my.cnf to something other than
/var/lib/mysql.  It mostly worked - the ebuild is careful
to read the current value of datadir from the my.cnf file.

The problem is that the pkg_config() function ignores
the value of datadir in one place; instead it hard codes
in /var/lib/mysql - ignoring the value set in my.cnf.
Comment 3 Francesco R. (RETIRED) gentoo-dev 2005-10-27 15:23:20 UTC
I'm afraid, probably missing a good dose of caffeine at the moment of reading.

Your bug was very clear and detailed since the first post.

Partially fixed now, that piece of code still need to be reworked a bit,
configuring database with a custom datadir should work now.