支援 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 選項