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.....
Created attachment 58466 [details, diff] fix init script to use basedir variable to locate mysqld_safe binary
please test 4.0.24-r2 or the new 4.1 series.
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. :(
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).
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.
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? :-))
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 ;)
Hi Francesco, yes, I forgot to run etc-update. ;) I see, the patch is in and it works. Thanks.