支援 MySQL 登入路徑和選項檔案。命令列開始時支援下列 MySQL 命令列選項
MySQL Shell 會讀取 MySQL 組態檔案中名為 [mysqlsh]
的區段,其中包含 MySQL Shell 命令列選項。
MySQL Shell 也會讀取 MySQL 組態檔案的 [client]
區段。
注意
某些 [client]
選項不受 MySQL Shell 支援,例如 local-infile
,而且有些選項在兩者中具有相同的名稱,但採用不同的值,例如 [client]
選項 --compress
和 [mysqlsh]
選項 compress=
。value
MySQL Shell 會針對這類選項傳回特定錯誤,並指定選項名稱和錯誤。
如需選項檔案位置、在 Windows 和 Linux 平台上的優先順序順序以及選項語法的相關資訊,請參閱使用選項檔案。如需登入路徑的相關資訊,請參閱--login-path
。
例如,如果您在選項檔案中定義以下內容,例如 c:\my.ini
[mysqlsh]
sql
[client]
host=localhost
user=user1
port=3306
database=sakila
這些選項設定如下
sql
:預設的 MySQL Shell 模式,SQL。host=localhost
:將主機定義為 localhost。user=user1
:將使用者定義為 user1。port=3306
:將連線埠定義為 3306。database=sakila
:將預設結構描述定義為 sakila。
執行不帶任何連線字串的 mysqlsh
> 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 >
注意
在命令列上定義的選項會覆寫所有其他值。
MySQL Shell 的優先順序順序
命令列引數
登入路徑
選項檔案
持續保存的 Shell 選項