Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 91997 - PATCH: fix /etc/init.d/mysql to support alternative $basedir
Summary: PATCH: fix /etc/init.d/mysql to support alternative $basedir
Status: VERIFIED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Gentoo Linux MySQL bugs team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-09 05:10 UTC by Martin Mokrejš
Modified: 2005-08-04 09:41 UTC (History)
0 users

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


Attachments
fix init script to use basedir variable to locate mysqld_safe binary (mysql.patch,854 bytes, patch)
2005-05-09 05:11 UTC, Martin Mokrejš
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Mokrejš 2005-05-09 05:10:21 UTC
Hi,
  I'm not very happy with the init script available. Imagine user wants to have
multiple installations of mysql on the computer. While setting basedir in /etc/my.cnf, the script still invokes /usr/bin/mysqld_safe wrapper which then
correctly executes $basedir/bin/mysqld.

  The script still uses my_print_defaults found by $PATH variable to parse the configfile, so this still imposes the conditions that all the mysql versions should have this binaries compatible in terms of output and ability to parse the config file. I don't have a problem with this.

  Tested:

root     14611     1  0 13:59 ?        00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/mysql/my.cnf
mysql    14647 14611  1 13:59 ?        00:00:00 /usr/local/mysql/bin/mysqld --defaults-file=/etc/mysql/my.cnf --basedir=/usr/l.....
Comment 1 Martin Mokrejš 2005-05-09 05:11:19 UTC
Created attachment 58466 [details, diff]
fix init script to use basedir variable to locate mysqld_safe binary
Comment 2 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-05-17 02:23:20 UTC
please test 4.0.24-r2 or the new 4.1 series.
Comment 3 Martin Mokrejš 2005-06-12 03:21:26 UTC
I tested 4.0.24-r2 now and it does not work well. The init.d script starts
safe_mysqld from correct place but the safe_mysqld starts /usr/local/mysql/bin -
that's a builtin fallback in safe_mysqld which I believe is wrong.

# ps -ef | grep mysql
root     17118     1  0 12:15 ?        00:00:00 /bin/sh
/usr/local/mysql-standard-4.1.12-pc-linux-gnu-i686/bin/mysqld_safe
--defaults-file=/etc/mysql/my.cnf
mysql    17156 17118  1 12:15 ?        00:00:00 /usr/local/mysql/bin/mysqld
--defaults-file=/etc/mysql/my.cnf
--basedir=/usr/local/mysql-standard-4.1.12-pc-linux-gnu-i686
--datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid
--skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock


So, I just continued:

# /etc/init.d/mysql stop
 * Stopping mysqld (/etc/mysql/my.cnf) ...                                     
                                      [ ok ]
# cd /usr/local
# rm mysql
# /etc/init.d/mysql start
 * Starting mysqld (/etc/mysql/my.cnf) ...
..... * MySQL NOT started, proceding anyway                                    
                                      [ ok ]
# ps -ef | grep mysql
root     17346  9080  0 12:16 pts/0    00:00:00 grep mysql
# 

I had a patch for safe_mysqld regarding this ... and it must be somewhere in
bugzilla already ... but don't know where. :(
Comment 4 Martin Mokrejš 2005-06-12 03:33:54 UTC
OK, I know where it is: http://bugs.gentoo.org/show_bug.cgi?id=83424, get update
of the dev-db_mysql-bin.tar.gz file #3 and extract from it
"files/safe_mysqld-4.1.11.patch" and I still do think also "files/mysql" (we
have to pass --basedir downstream).
Comment 5 Martin Mokrejš 2005-06-12 03:44:38 UTC
Correction to note #4: we also have to pass --language otherwise safe_mysqld
will blindly enforce /usr/local/mysql/share/mysql/english, which doesn't exist
in this testcase.

#
# cd /usr/local/mysql-standard-4.1.12-pc-linux-gnu-i686/bin/
# patch -p4 < /usr/local/portage/dev-db/mysql-bin/files/safe_mysqld-4.1.11.patch
# ./bin/mysqld_safe --defaults-file=/etc/mysql/my.cnf
--basedir=/usr/local/mysql-standard-4.1.12-pc-linux-gnu-i686
Starting mysqld daemon with databases from /var/lib/mysql
STOPPING server from pid file /var/run/mysqld/mysqld.pid
050612 12:36:25  mysqld ended


   Note: it died because of: 
[ERROR] Can't find messagefile '/usr/local/mysql/share/mysql/english/errmsg.sys'


# ./bin/mysqld_safe --defaults-file=/etc/mysql/my.cnf
--basedir=/usr/local/mysql-standard-4.1.12-pc-linux-gnu-i686
--language=/usr/local/mysql-standard-4.1.12-pc-linux-gnu-i686/share/mysql/english
Starting mysqld daemon with databases from /var/lib/mysql


So you see one has to patch safe_mysqld to be able to start mysqld from another
location just by tweaking basedir in my.cnf file.
Comment 6 Martin Mokrejš 2005-08-04 07:46:42 UTC
Hi Francesco,
  could this patch be applied to mysql-4.0.25-r2? It sucks I have to keep
official binaries from MYSQL in /usr/local, but can live with that. But what
really sucks is that I need the "official" mysql from gentoo so that other
packages pick-up the shared library eaisly and all deps. But, the init script
gets overwritten by gentoo ebuild ... So, I need someone to pick-up thsi path,
please. ;)

  How about the mysql-bin ebuild lying in bugzilla as well? :-))
Comment 7 Francesco R. (RETIRED) gentoo-dev 2005-08-04 09:02:06 UTC
Martin if you referred to the patch that add the basedir it's already included
in mysql-4.0.25-r2 . Do you forget an dispatch.conf ?

try this as a workaround:

#emerge --sync
#mv /etc/init.d/mysql /etc/init.d/mysql
#cp /usr/portage/dev-db/mysql/files /etc/init.d/mysql

replace "/usr/portage/" whit your $PORTDIR.

P.S. I'm already listed into the mysql-bugs@gentoo.org aliases ;)
Comment 8 Martin Mokrejš 2005-08-04 09:41:35 UTC
Hi Francesco, yes, I forgot to run etc-update. ;) I see, the patch is in and it
works. Thanks.