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.
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
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.
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.