Bug #75366 mysql_install_db requires explicit --lc-messages-dir if non-default PREFIX used
Submitted: 31 Dec 2014 12:18 Modified: 30 Jan 2015 8:00
Reporter: Valeriy Kravchuk Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:5.7.5 OS:Any
Assigned to: CPU Architecture:Any
Tags: mysql_install_db, regression

[31 Dec 2014 12:18] Valeriy Kravchuk
Description:
I've build MySQL 5.7 from git with non-default -DCMAKE_INSTALL_PREFIX like this:

2072     cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_CONFIG=mysql_release -DFEATURE_SET=community -DWITH_EMBEDDED_SERVER=OFF -DCMAKE_INSTALL_PREFIX=/home/openxs/dbs/5.7 -DWITH_BOOST=/home/openxs/boost

In previous versions mysql_install_db when called from that prefix/basedir like this:

bin/mysql_install_db --no-defaults

just worked and was able to use proper default datadir etc. Now one has top specify datadir (and manual explains that, see http://dev.mysql.com/doc/refman/5.7/en/mysql-install-db.html#option_mysql_install_db_datad...), but it seems in my case one has to specify --lc-messages-dir explicitly as well:

openxs@ao756:~/dbs/5.7$ bin/mysql_install_db --no-defaults --datadir=/home/openxs/dbs/5.7/data/ --lc-messages-dir=/home/openxs/dbs/5.7/share

Otherwise mysql_install-db does not work. Maybe one has just to set --basedir explicitly, but in both cases manual does NOT say these options are mandatory for my case. So, this can be considered like a regression in your new implementation of mysql_install_db.

Server started with --no-defaults is able to find/get lc_messages_dir without problem:

mysql> show variables like 'lc%';
+-----------------+-----------------------------+
| Variable_name   | Value                       |
+-----------------+-----------------------------+
| lc_messages     | en_US                       |
| lc_messages_dir | /home/openxs/dbs/5.7/share/ |
| lc_time_names   | en_US                       |
+-----------------+-----------------------------+
3 rows in set (0,00 sec)

How to repeat:
Try to build from source and then install MySQL 5.7.5 using commands like these:

cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_CONFIG=mysql_release -DFEATURE_SET=community -DWITH_EMBEDDED_SERVER=OFF -DCMAKE_INSTALL_PREFIX=/home/openxs/dbs/5.7 -DWITH_BOOST=/home/openxs/boost
make -j 2
make install && make clean
cd /home/openxs/dbs/5.7
rm -rf data/*
bin/mysql_install_db --no-defaults --datadir=/home/openxs/dbs/5.7/data/

Enjoy the output of the last command and then try to find explanation in the manual.

Suggested fix:
Either fix build scripts/mysql_install_db code to take -DCMAKE_INSTALL_PREFIX into account properly while checking location for messages, or explain in the manual what options for this utility are mandatory in this case.
[31 Dec 2014 12:24] Shane Bester
http://bugs.mysql.com/bug.php?id=73845
[31 Dec 2014 19:55] Valeriy Kravchuk
I do not agree with "Not a Bug" status for bug #73845. I do not see this change documented anywhere and I fail to see any reason to NOT infer the location of messages for mysql_install_db from the same information that lets mysqld to get it properly.

So, let's try again with this report...
[12 Jan 2015 14:05] Umesh Shastry
Hello Valeriy,

Thank you for the report.

Thanks,
Umesh
[12 Jan 2015 14:05] Umesh Shastry
//
[root@cluster-repo setups]# wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.5-m15.tar.gz
[root@cluster-repo setups]# md5sum mysql-5.7.5-m15.tar.gz
95aa1873fd414482a1a88752cbde46bd  mysql-5.7.5-m15.tar.gz

[root@cluster-repo setups]# tar -zxvf mysql-5.7.5-m15.tar.gz

[root@cluster-repo setups]# cd mysql-5.7.5-m15
[root@cluster-repo mysql-5.7.5-m15]# pwd
/data/ushastry/setups/mysql-5.7.5-m15

[root@cluster-repo mysql-5.7.5-m15]# cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_CONFIG=mysql_release -DFEATURE_SET=community -DWITH_EMBEDDED_SERVER=OFF -DCMAKE_INSTALL_PREFIX=/data/ushastry/setups/mysql-5.7.5-m15 -DWITH_BOOST=/data/ushastry/setups/mysql-5.7.5-m15
-- Running cmake version 2.8.12.2
-- Configuring with MAX_INDEXES = 64U
-- SIZEOF_VOIDP 8
-- MySQL 5.7.5-m15
-- Packaging as: mysql-5.7.5-m15-Linux-x86_64
-- Local boost dir LOCAL_BOOST_DIR-NOTFOUND
-- Local boost zip LOCAL_BOOST_ZIP-NOTFOUND
-- Downloading boost_1_55_0.tar.gz to /data/ushastry/setups/mysql-5.7.5-m15
-- [download 0% complete]
-- [download 100% complete]
-- [download 0% complete]
-- [download 1% complete]
..

-- [download 100% complete]
-- cd /data/ushastry/setups/mysql-5.7.5-m15; tar xfz /data/ushastry/setups/mysql-5.7.5-m15/boost_1_55_0.tar.gz
-- BOOST_VERSION_NUMBER is #define BOOST_VERSION 105500
-- BOOST_INCLUDE_DIR /data/ushastry/setups/mysql-5.7.5-m15/boost_1_55_0
-- Using cmake version 2.8.12.2
-- Disabling -Wunused-but-set-variable warning for building NDB
-- Disabling -Wstrict-aliasing warning for building NDB
-- Not building NDB
-- Library mysqlclient depends on OSLIBS -lpthread;m;rt;dl
-- CMAKE_BUILD_TYPE: RelWithDebInfo
-- COMPILE_DEFINITIONS: _GNU_SOURCE;_FILE_OFFSET_BITS=64;HAVE_CONFIG_H
-- CMAKE_C_FLAGS:  -Wall -Wextra -Wformat-security -Wvla -Wwrite-strings -Wdeclaration-after-statement
-- CMAKE_CXX_FLAGS:  -Wall -Wextra -Wformat-security -Wvla -Woverloaded-virtual -Wno-unused-parameter
-- CMAKE_C_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF
-- CMAKE_CXX_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF
-- Configuring done
-- Generating done
-- Build files have been written to: /data/ushastry/setups/mysql-5.7.5-m15

[root@cluster-repo mysql-5.7.5-m15]# make -j 2
[root@cluster-repo mysql-5.7.5-m15]# make install && make clean

bin/mysql_install_db --no-defaults --datadir=/data/ushastry/setups/mysql-5.7.5-m15/data

[root@cluster-repo mysql-5.7.5-m15]# bin/mysql_install_db --no-defaults --datadir=/data/ushastry/setups/mysql-5.7.5-m15/data
2015-01-14 20:52:41 [ERROR]   The child process terminated prematurely. Errno= 32
2015-01-14 20:52:41 [ERROR]   Failed to execute /data/ushastry/setups/mysql-5.7.5-m15/bin/mysqld --no-defaults --bootstrap --datadir=/data/ushastry/setups/mysql-5.7.5-m15/data --lc-messages-dir=/usr/share/mysql --lc-messages=en_US
-- server log begin --

-- server log end --

[root@cluster-repo mysql-5.7.5-m15]# rm -rf data/
[root@cluster-repo mysql-5.7.5-m15]# bin/mysql_install_db --no-defaults --datadir=/data/ushastry/setups/mysql-5.7.5-m15/data -v
2015-01-14 20:52:56 [NOTE]    Creating data directory /data/ushastry/setups/mysql-5.7.5-m15/data
2015-01-14 20:52:56 [NOTE]    Generating random password to /root/.mysql_secret...done.
2015-01-14 20:52:56 [NOTE]    Executing /data/ushastry/setups/mysql-5.7.5-m15/bin/mysqld --no-defaults --bootstrap --datadir=/data/ushastry/setups/mysql-5.7.5-m15/data --lc-messages-dir=/usr/share/mysql --lc-messages=en_US
2015-01-14 20:53:04 [NOTE]    Creating system tables...failed.
2015-01-14 20:53:04 [ERROR]   The child process terminated prematurely. Errno= 32
2015-01-14 20:53:04 [ERROR]   Failed to execute /data/ushastry/setups/mysql-5.7.5-m15/bin/mysqld --no-defaults --bootstrap --datadir=/data/ushastry/setups/mysql-5.7.5-m15/data --lc-messages-dir=/usr/share/mysql --lc-messages=en_US
-- server log begin --

-- server log end --

// with --lc-messages-dir
[root@cluster-repo mysql-5.7.5-m15]# rm -rf data/
[root@cluster-repo mysql-5.7.5-m15]# bin/mysql_install_db --no-defaults --datadir=/data/ushastry/setups/mysql-5.7.5-m15/data --lc-messages-dir=/data/ushastry/setups/mysql-5.7.5-m15/share/ -v
2015-01-14 21:03:06 [NOTE]    Creating data directory /data/ushastry/setups/mysql-5.7.5-m15/data
2015-01-14 21:03:06 [NOTE]    Generating random password to /root/.mysql_secret...done.
2015-01-14 21:03:06 [NOTE]    Executing /data/ushastry/setups/mysql-5.7.5-m15/bin/mysqld --no-defaults --bootstrap --datadir=/data/ushastry/setups/mysql-5.7.5-m15/data --lc-messages-dir=/data/ushastry/setups/mysql-5.7.5-m15/share --lc-messages=en_US
2015-01-14 21:03:21 [NOTE]    Creating system tables...done.
2015-01-14 21:03:21 [NOTE]    Filling system tables with data...done.
2015-01-14 21:04:20 [NOTE]    Filling help table with data...done.
2015-01-14 21:04:20 [NOTE]    Creating default user root@localhost
2015-01-14 21:04:20 [NOTE]    Creating default proxy root@localhost
2015-01-14 21:04:56 [NOTE]    Success!
[27 Jan 2015 13:42] Georgi Kodinov
Posted by developer:
 
mysql_install_db is deprecated. WL#7307 is pushed into the trunk that does not suffer this problem. Please consider using --initialize instead.