Bug #75883 mysql_install_db usability improvements
Submitted: 12 Feb 2015 19:54 Modified: 13 Feb 2015 19:41
Reporter: Roel Van de Paar Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:5.7.5-m15 OS:Any
Assigned to: CPU Architecture:Any

[12 Feb 2015 19:54] Roel Van de Paar
Description:
#1: mysql_install_db cannot locate mysqld;

[sda]$ rm -Rf /dev/shm/573153
[sda]$ ./MS-mysql-5.7.5-m15-linux-x86_64-debug/bin/mysql_install_db --no-defaults --datadir=/dev/shm/573153
2015-02-13 06:38:07 [ERROR]   Can't locate the server executable (mysqld).
[sda]$ cd MS-mysql-5.7.5-m15-linux-x86_64-debug
[MS-mysql-5.7.5-m15-linux-x86_64-debug]$ ./bin/mysql_install_db --no-defaults --datadir=/dev/shm/573153
[...mysqld was found...]

So, if mysql_install_db can find mysqld when being used as ./bin/mysql_install_db, why can it not locate it when it's used as ./somedir/bin/mysqld_install_db?

#2 mysql_install_db cannot locate basedir automatically and is undescriptive in it's own output;

[MS-mysql-5.7.5-m15-linux-x86_64-debug]$ ./bin/mysql_install_db --no-defaults --datadir=/dev/shm/573153
2015-02-13 06:38:21 [ERROR]   The child process terminated prematurely. Errno= 32
2015-02-13 06:38:21 [ERROR]   Failed to execute /sda/MS-mysql-5.7.5-m15-linux-x86_64-debug/bin/mysqld --no-defaults --bootstrap --datadir=/dev/shm/573153/131/da
ta --lc-messages-dir=/usr/share/mysql --lc-messages=en_US
-- server log begin --

-- server log end --

Error 32 ("broken pipe"), no sever log ouptut, nothing descriptive; it's completely unclear what went wrong. Also, it now has auto-found mysqld, so why not look for other bits it needs?

Finally,
./bin/mysql_install_db --no-defaults --datadir=/dev/shm/573153/131/data --basedir=${PWD}

Works fine.

How to repeat:
#1 ./somedir/bin/mysql_install_db --no-defaults --datadir=/dev/shm/573153/131/data
#2 ./bin/mysql_install_db --no-defaults --datadir=/dev/shm/573153/131/data

Suggested fix:
#1 Let mysql_install_db find mysqld in it's own (./) directory always
#2 Let mylsq_install_db find the basedir automatically if it is in one (i.e. no need to use --basedir option) and/or significantly improve output when it fails, .e. error user friendliness
[13 Feb 2015 11:41] MySQL Verification Team
Hello Roel,

Thank you for the report.
imho m_i_db is deprecated for 5.7. Please consider using mysqld --initialize (scheduled for an upcoming release)... 

Please see the notes in related bugs Bug #74469, Bug #75366, Bug #73845 and Bug #75366

Thanks,
Umesh
[13 Feb 2015 19:41] Roel Van de Paar
Umesh, will mysqld --initialize fix the problems listed here and in Bug #73845? It seems a bit like a ticking timebomb? When will mysqld --initialize be available for testing?