Documentation Home
MySQL 9.1 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 40.4Mb
PDF (A4) - 40.5Mb
Man Pages (TGZ) - 259.5Kb
Man Pages (Zip) - 366.7Kb
Info (Gzip) - 4.1Mb
Info (Zip) - 4.1Mb


MySQL 9.1 Reference Manual  / ...  / MySQL Programs  / Using MySQL Programs  / Specifying Program Options  /  Command-Line Options that Affect Option-File Handling

6.2.2.3 Command-Line Options that Affect Option-File Handling

Most MySQL programs that support option files handle the following options. Because these options affect option-file handling, they must be given on the command line and not in an option file. To work properly, each of these options must be given before other options, with these exceptions:

When specifying file names as option values, avoid the use of the~ shell metacharacter because it might not be interpreted as you expect.

Table 6.3 Option File Option Summary

Option NameDescription
--defaults-extra-fileRead named option file in addition to usual option files
--defaults-fileRead only named option file
--defaults-group-suffixOption group suffix value
--login-pathRead login path options from .mylogin.cnf
--no-defaultsRead no option files
--no-login-pathsDo not read options from login path file

  • --defaults-extra-file=file_name

    Command-Line Format--defaults-extra-file=filename
    TypeFile name
    Default Value[none]

    Read this option file after the global option file but (on Unix) before the user option file and (on all platforms) before the login path file. (For information about the order in which option files are used, seeSection 6.2.2.2, “Using Option Files”.) If the file does not exist or is otherwise inaccessible, an error occurs. Iffile_name is not an absolute path name, it is interpreted relative to the current directory.

    See the introduction to this section regarding constraints on the position in which this option may be specified.

  • --defaults-file=file_name

    Command-Line Format--defaults-file=filename
    TypeFile name
    Default Value[none]

    Read only the given option file. If the file does not exist or is otherwise inaccessible, an error occurs.file_name is interpreted relative to the current directory if given as a relative path name rather than a full path name.

    Exceptions: Even with--defaults-file,mysqld readsmysqld-auto.cnf and client programs read.mylogin.cnf.

    See the introduction to this section regarding constraints on the position in which this option may be specified.

  • --defaults-group-suffix=str

    Command-Line Format--defaults-group-suffix=string
    TypeString
    Default Value[none]

    Read not only the usual option groups, but also groups with the usual names and a suffix ofstr. For example, themysql client normally reads the[client] and[mysql] groups. If this option is given as--defaults-group-suffix=_other,mysql also reads the[client_other] and[mysql_other] groups.

  • --login-path=name

    Command-Line Format--login-path=name
    TypeString
    Default Value[none]

    Read options from the named login path in the.mylogin.cnf login path file. Alogin path is an option group containing options that specify which MySQL server to connect to and which account to authenticate as. To create or modify a login path file, use themysql_config_editor utility. SeeSection 6.6.7, “mysql_config_editor — MySQL Configuration Utility”.

    A client program reads the option group corresponding to the named login path, in addition to option groups that the program reads by default. Consider this command:

    mysql --login-path=mypath

    By default, themysql client reads the[client] and[mysql] option groups. So for the command shown,mysql reads[client] and[mysql] from other option files, and[client],[mysql], and[mypath] from the login path file.

    Client programs read the login path file even when the--no-defaults option is used, unless--no-login-paths is set.

    To specify an alternate login path file name, set theMYSQL_TEST_LOGIN_FILE environment variable.

    See the introduction to this section regarding constraints on the position in which this option may be specified.

  • --no-login-paths

    Command-Line Format--no-login-paths
    TypeBoolean
    Default Valuefalse

    Skips reading options from the login path file. Client programs always read the login path file without this option even when the--no-defaults option is used.

    See--login-path for related information.

    See the introduction to this section regarding constraints on the position in which this option may be specified.

  • --no-defaults

    Command-Line Format--no-defaults
    TypeBoolean
    Default Valuefalse

    Do not read any option files. If program startup fails due to reading unknown options from an option file,--no-defaults can be used to prevent them from being read.

    The exception is that client programs read the.mylogin.cnf login path file, if it exists, even when--no-defaults is used unless--no-login-paths is set. This permits passwords to be specified in a safer way than on the command line even if--no-defaults is present. To create.mylogin.cnf, use themysql_config_editor utility. SeeSection 6.6.7, “mysql_config_editor — MySQL Configuration Utility”.

  • --print-defaults

    Command-Line Format--print-defaults
    TypeBoolean
    Default Valuefalse

    Print the program name and all options that it gets from option files. Password values are masked.

    See the introduction to this section regarding constraints on the position in which this option may be specified.