MySQL defaults-file argument not recognized

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.


I would like to add another answer to this problem to a similar situation I faced.

In my case, the command was similar to this:

/path/to/mysqld_safe start --defaults-file=/path/to/my.cnf --other-options-here

and mysql would complain

unknown variable '--defaults-file=/path/to/my.cnf'

In order to solve this, I had to "drop" the start command, making the line read like this:

/path/to/mysqld_safe --defaults-file=/path/to/my.cnf --other-options-here

And then mysql would finally start using the specified configuration file.


In my case the issue was misplacement of the parameters.

the --console parameter should have been last...

My original take:

mysqld --console --defaults-file="path-to-ini/my.ini"

While should have run this:

mysqld --defaults-file="path-to-ini/my.ini" --console

Tags:

Mysql