Bug #54034 mysql_install_db assumes cwd is the installation prefix
Submitted: 27 May 2010 14:58 Modified: 23 Sep 2014 22:14
Reporter: Vasil Dimov Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.5 OS:Any
Assigned to: CPU Architecture:Any

[27 May 2010 14:58] Vasil Dimov
Description:
This is a regression since 5.1, in 5.1 one could run the mysql_install_db script from any location (btw it gets installed in PREFIX/bin/mysql_install_db in 5.1). In 5.5, the current working directory must be PREFIX, otherwise:

/tmp$ ./autotest/mysql-install/scripts/mysql_install_db  

FATAL ERROR: Could not find ./bin/my_print_defaults

If you compiled from source, you need to run 'make install' to
copy the software into the correct location ready for operation.

If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.

/tmp$

How to repeat:
Just run PREFIX/scripts/mysql_install_db from cwd != PREFIX
[28 Aug 2011 12:45] Susanne Ebrecht
Hello Folk,

this problem still exist in actual 5.5 released download tree.

./mysql_install_db

FATAL ERROR: Could not find ./bin/my_print_defaults

I hope  you all feel well,

Susanne
[28 Aug 2011 13:33] Susanne Ebrecht
Ahhhhhh

I just figured out - the problem is that you should not execute the mysql_install_db by being in sub folder scripts. That you just need to execute it
out of the basedir.

I think mysql_install_db should throw an error when you execute it from wrong folder.

Susanne
[4 Apr 2012 21:52] SERC Team
Bug fix. The script file can be accessed from outside the basedir and no longer assumes that cwd is the installation prefix.

Attachment: mysql_install_db.sh (application/octet-stream, text), 14.50 KiB.

[17 Jul 2013 17:55] Sohair Butt
Resubmitting the solution (as a "Contribution") that I worked on when I was with the SERC team. Description in the post above.

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: mysql_install_db.sh (application/octet-stream, text), 14.50 KiB.

[2 Apr 2014 11:35] Ståle Deraas
Hi Sohair, we are currently doing a rehaul of this code, and will probably not need your contribution. But thanks again for contributing to MySQL. We will keep the bug open until we have the final solution (of course).
[23 Sep 2014 22:14] Paul DuBois
Noted in 5.7.5 changelog.

mysql_install_db could fail if not invoked in the MySQL installation
base directory.