Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL defaults-file argument not recognized

Tags:

mysql

I am trying to log in to mysql with the --defaults-file option on the command line:

$ mysql --defaults-file ~/mycnf.cnf

But I get the following error:

mysql: unknown option '--defaults-file'

But this option is listed in the help:

$ mysql --help
...
Default options are read from the following files in the given order:
/etc/mysql/my.cnf /etc/my.cnf ~/.my.cnf
The following groups are read: mysql client
The following options may be given as the first argument:
--print-defaults        Print the program argument list and exit.
--no-defaults           Don't read default options from any option file.
--defaults-file=#       Only read default options from the given file #.
--defaults-extra-file=# Read this file after the global files are read.
--defaults-file=#       Only read default options from the given file #.

Whats going on here? Here is the output of mysql --version

$ mysql --version
mysql  Ver 14.14 Distrib 5.1.69, for redhat-linux-gnu (x86_64) using readline 5.1
like image 693
David Williams Avatar asked May 23 '13 18:05

David Williams


1 Answers

It should be:

mysql --defaults-file=~/mycnf.cnf

You were missing the =.

Also note that the options used to specify option files must precede any other options. See the documentation for specific details.

like image 64
Barmar Avatar answered Oct 21 '22 08:10

Barmar