As of MySQL Shell 8.0.32, MySQL login paths and option files are supported. The following MySQL command line options are supported at the start of the command line:
MySQL Shell reads a section in the MySQL configuration file,
[mysqlsh]
, which contains the MySQL Shell
command line options.
MySQL Shell also reads the [client]
section
of the MySQL configuration file.
Some [client]
options are not supported by
MySQL Shell, such as local-infile
, and
some options have the same name in both, but take different
values, such as the [client]
option
--compress
and the
[mysqlsh]
option
compress=
.
value
MySQL Shell returns a specific error for such options, specifying the name of the option and the error.
For information on option file locations, order of precedence on
Windows and Linux platforms, and option syntax, see
Using Option Files. For information on login-path,
see --login-path
.
For example, if you define the following in your options file,
c:\my.ini
for example:
[mysqlsh]
sql
[client]
host=localhost
user=user1
port=3306
database=sakila
These options set the following:
sql
: the default MySQL Shell mode, SQL.host=localhost
: defines the host as localhost.user=user1
: defines the user as user1.port=3306
: defines the connection port as 3306.database=sakila
: defines the default schema as sakila.
Run mysqlsh
without any connection string:
> mysqlsh
MySQL Shell 8.0.32-commercial
Copyright (c) 2016, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.
Type '\help' or '\?' for help; '\quit' to exit.
Creating a Classic session to 'root@localhost:3306/sakila'
Fetching global names, object names from `sakila` for auto-completion... Press ^C to stop.
Your MySQL connection id is 93
Server version: 8.0.31-commercial MySQL Enterprise Server - Commercial
Default schema set to `sakila`.
localhost:3306 ssl sakila SQL >
Options defined on the command line override all other values.
The order of precedence for MySQL Shell:
Command line arguments
Login path
Option files
Persisted Shell options