1

My Ubuntu Linux development machine I have the following ~/.my.cnf file which is a great time saver when connecting to mysql from the command line.

[client]
auto-rehash
safe-updates
host     = localhost
user     = root
password = mysql
prompt   = "[\d]>"

However, when I type mysqladmin I receive the error

mysqladmin: unknown option '--auto-rehash'

The problem is some of the lines in the .my.cnf file aren't applicable to mysqladmin and mysqldump.

Is there a way to specify configuration options in .my.cnf such that they will apply to either mysql or mysqladmin, mysqldump or both?

If not, how do I start a mysqldump from command line and specify to it not to read the .my.cnf settings?

Andy Fusniak
  • 1,548
  • 1
  • 17
  • 28

1 Answers1

1

Put those options in a separate group, subject to the selected application:

[client]
safe-updates
host     = localhost
user     = root
password = mysql
prompt   = "[\d]>"

[mysql]
auto-rehash

Read more about usage of config file on MySQL docs.

hjpotter92
  • 78,589
  • 36
  • 144
  • 183
  • 2
    This is the right idea, but backwards... auto-rehash *breaks* mysqladmin, and belongs in a `[mysql]` section. `[client]` should only be used for options that are valid for all client utilities. – Michael - sqlbot Nov 09 '15 at 10:39