Bug #31086 mysql_install_db does not properly use basedir parameter
Submitted: 18 Sep 2007 17:03 Modified: 26 Sep 2007 15:36
Reporter: Alexander Rubin Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:5.1.22-rc, 5.1.21 OS:Linux
Assigned to: CPU Architecture:Any

[18 Sep 2007 17:03] Alexander Rubin
Description:
For the binary installation (non-rpm) on linux,
mysql_install_db does not properly use basedir parameter:

$ cd /data1/arubin/mysql-5.1.22-rc-linux-x86_64-glibc23/
$ ./scripts/mysql_install_db --basedir=/data1/arubin/mysql-5.1.22-rc-linux-x86_64-glibc23 --datadir=/data1/arubin/mysql_data
Neither host 'linux' nor 'localhost' could be looked up with
/resolveip
Please configure the 'hostname' command to return a correct
hostname.
If you want to solve this at a later stage, restart this script
with the --force option

But this is not the correct message actually.
The problem is that extra_bindir parameter does not setup properly if basedir is given:

if test -z "$basedir" -a "$source_install" = 0
then
  basedir="."
  bindir="./bin"
  extra_bindir="$bindir"
  mysqld="./bin/mysqld"
  pkgdatadir="./share"
else
  bindir="$basedir/bin"
  # We set up bootstrap-specific paths later, so skip this for --windows
  if test "$windows" -eq 0
  then
    mysqld=`find_in_basedir mysqld libexec sbin bin`
    if test -z "$basedir"
    then
      # We come here when source-install is given
      bindir="$basedir/bin"
      extra_bindir="$bindir"
    fi
    if test -x "$mysqld"
    then
      pkgdatadir=`find_in_basedir --dir fill_help_tables.sql share share/mysql scripts`
      if test -z "$pkgdatadir"
      then
        missing_in_basedir fill_help_tables.sql
       exit 1
      fi
    else
      if test -x "./sql/mysqld"
      then
        # Source installation
        mysqld="./sql/mysqld"
        bindir="./client"
        extra_bindir="./extra"
        pkgdatadir="./scripts"
        mysqld_opt="--language=./sql/share/english"
      else
        missing_in_basedir mysqld
      fi
    fi
  fi
fi

So, if basedir is given and it is not windows, script only setup pkgdir and does not setup extra_bindir.
This cause error with resolveip later on as extrabindir is not correct

How to repeat:
run ./scripts/mysql_install_db with basedir option

Suggested fix:
Fix the mysql_install_db script to accept the basedir option
[18 Sep 2007 17:36] Valeriy Kravchuk
Thank you for a problem report. Isn't it a duplicate of bug #31057, but on Linux? Please, check.
[18 Sep 2007 17:54] Alexander Rubin
> Isn't it a duplicate of bug #31057, but on Linux? 

Yes, simular. 
However, on linux if you run mysql_install_db without basedir (for example with no params at all or only with --datadir) it will work fine
[18 Sep 2007 18:15] Alexander Rubin
Same behavior with freebsd 6.2
[19 Sep 2007 16:47] MySQL Verification Team
Thank you for the bug report.

[miguel@skybr 5.1]$ /home/miguel/dbs/mysql-5.1/scripts/mysql_install_db --basedir=/home/miguel/dbs/5.1
Neither host 'skybr.net' nor 'localhost' could be looked up with
/resolveip
Please configure the 'hostname' command to return a correct
hostname.
If you want to solve this at a later stage, restart this script
with the --force option
[miguel@skybr 5.1]$ /home/miguel/dbs/mysql-5.1/scripts/mysql_install_db
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/home/miguel/dbs/5.1/bin/mysqladmin -u root password 'new-password'
/home/miguel/dbs/5.1/bin/mysqladmin -u root -h skybr.net password 'new-password'
See the manual for more instructions.
You can start the MySQL daemon with:
cd /home/miguel/dbs/5.1 ; /home/miguel/dbs/5.1/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl

Please report any problems with the /home/miguel/dbs/5.1/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
[miguel@skybr 5.1]$ ls var/
mysql  test
[miguel@skybr 5.1]$
[26 Sep 2007 15:36] Daniel Fischer
Duplicate of bug#30759.