Bug #11641 mysql_fix_privilege_tables: --no-defaults used, wrong mysql app
Submitted: 29 Jun 2005 14:00 Modified: 15 Dec 2010 9:50
Reporter: Geert Vanderkelen Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: General Severity:S4 (Feature request)
Version:* OS:Any
Assigned to: CPU Architecture:Any
Triage: Needs Triage: D5 (Feature request)

[29 Jun 2005 14:00] Geert Vanderkelen
Description:
Hi,

(In 4.0/4.1/5.0)

When running multiple versions, it's nice to be able to use --defaults-file.

./bin/mysql_fix_privilege_tables --defaults-file=/var/mysql/50/my.cnf

The --defaults-file= is handled and used, but not when calling the mysql program.

Also, wrong mysql client is used. My installation is in /usr/local/mysql-50/ :)

Regards,

Geert

How to repeat:

./bin/mysql_fix_privilege_tables --defaults-file=/var/mysql/50/my.cnf --verbose

The $cmd variables will not use the --defaults-file, but allways --no-defaults. Also, /usr/local/mysql/bin/mysql will mostly be used.

Suggested fix:
A bit like mysql_config:

get_full_path ()
{
  if [ -h $1 ];
  then
     echo `ls -l $1 | awk '{ print $NF }'`
  else
    case $1 in
     /*)        echo "$1";;
     ./*) tmp=`pwd`/$1; echo $tmp | sed -e 's;/\./;/;' ;;
     *) which $1 ;;
    esac
  fi
}

me=`get_full_path $0`
basedir=`echo $me | sed -e 's;/bin/mysql_fix_privilege_tables;;'`

# Find where 'mysql' command is located

if test -z "$bindir"
then
  for i in $basedir/bin ./bin ../bin/ /usr/local/mysql/bin client
  do
    if test -f $i/mysql
    then
      bindir=$i
      break
    fi
  done
fi

cmd="$bindir/mysql $defaults --force --user=$user --host=$host"
[15 Dec 2010 9:50] Valeriy Kravchuk
Looks like even in current 5.1.x --no-defaults is still always used in $cmd in this script.