1

While installing from binaries. The below always gives error when we execute from 'scripts' directory

[mysql@hostname ~]$ cd /mysql/product/5.6.12/scripts/
[mysql@hostname ~]$ . mysql_install_db --defaults-file=my.cnf

-bash: use: command not found

But the same works fine when I execute one step back from scripts directory

[mysql@hostname ~]$ scripts/mysql_install_db --defaults-file=my.cnf

Question: Why this happens ?

3
  • I guess it's expecting to be one dir up from scripts, when it's not then something goes wrong & it drops out of the mysql shell, then tries to execute the "use" (intended for the mysql interpreter) in the shell – Philᵀᴹ Jan 15 '16 at 12:58
  • Open the mysql_install_db file and go through the script - IIRC it's a text script file. – Vérace Jan 15 '16 at 13:53
  • 1
    It may work if you do ./mysql... ? Specify the path of the my.cnf if it's not in the scripts directory. – Vérace Jan 15 '16 at 14:23
1

I think you have a mistake, you can't execute:

[mysql@hostname ~]$ . mysql_install_db --defaults-file=my.cnf

Because the correct line is:

[mysql@hostname ~]$ ./mysql_install_db --defaults-file=my.cnf

You don't have in PATH environtment variable the current directory ".".

0

The problem appears to be that you're trying to source the installation script by putting . (dot space) in front of the script name. This behaves differently from executing the script.

Prefix the mysql_install_db with a ./ instead:

./mysql_install_db

When you execute it from the level above, you're not including the . (dot space), so it executes the script and works as you expect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.