文件首頁
MySQL 8.4 參考手冊
相關文件 下載本手冊
PDF (US Ltr) - 39.9Mb
PDF (A4) - 40.0Mb
手冊頁 (TGZ) - 258.5Kb
手冊頁 (Zip) - 365.5Kb
Info (Gzip) - 4.0Mb
Info (Zip) - 4.0Mb


MySQL 8.4 參考手冊  /  ...  /  ndb_drop_index — 從 NDB 資料表捨棄索引

25.5.10 ndb_drop_index — 從 NDB 資料表捨棄索引

ndb_drop_indexNDB 資料表中捨棄指定的索引。建議您僅將此工具作為撰寫 NDB API 應用程式的範例—詳細資訊請參閱本節後面的警告。

用法

ndb_drop_index -c connection_string table_name index -d db_name

上面顯示的陳述式會從 資料庫 中的 資料表 捨棄名為 索引 的索引。

下表顯示可與 ndb_drop_index 一起使用的選項。其他描述會顯示在資料表後面。

  • --character-sets-dir

    命令列格式 --character-sets-dir=路徑

    包含字元集的目錄。

  • --connect-retries

    命令列格式 --connect-retries=#
    類型 整數
    預設值 12
    最小值 0
    最大值 12

    放棄之前重試連線的次數。

  • --connect-retry-delay

    命令列格式 --connect-retry-delay=#
    類型 整數
    預設值 5
    最小值 0
    最大值 5

    嘗試聯絡管理伺服器之間要等待的秒數。

  • --connect-string

    命令列格式 --connect-string=連線字串
    類型 字串
    預設值 [無]

    --ndb-connectstring 相同。

  • --core-file

    命令列格式 --core-file

    發生錯誤時寫入核心檔案;用於除錯。

  • --database-d

    命令列格式 --database=名稱
    類型 字串
    預設值 TEST_DB

    資料表所在的資料庫名稱。

  • --defaults-extra-file

    命令列格式 --defaults-extra-file=路徑
    類型 字串
    預設值 [無]

    讀取全域檔案之後,讀取指定的檔案。

  • --defaults-file

    命令列格式 --defaults-file=路徑
    類型 字串
    預設值 [無]

    僅從指定的檔案讀取預設選項。

  • --defaults-group-suffix

    命令列格式 --defaults-group-suffix=字串
    類型 字串
    預設值 [無]

    也讀取 concat(群組, 字尾) 的群組。

  • --help

    命令列格式 --help

    顯示說明文字並結束。

  • --login-path

    命令列格式 --login-path=路徑
    類型 字串
    預設值 [無]

    從登入檔案讀取指定的路徑。

  • --no-login-paths

    命令列格式 --no-login-paths

    略過從登入路徑檔案讀取選項。

  • --ndb-connectstring

    命令列格式 --ndb-connectstring=連線字串
    類型 字串
    預設值 [無]

    設定連線字串以連線至 ndb_mgmd。語法:[nodeid=id;][host=]主機名稱[:連接埠]。覆寫 NDB_CONNECTSTRINGmy.cnf 中的項目。

  • --ndb-mgm-tls

    命令列格式 --ndb-mgm-tls=層級
    類型 列舉
    預設值 寬鬆
    有效值

    寬鬆

    嚴格

    設定連線至管理伺服器所需的 TLS 支援層級;為 寬鬆嚴格 其中之一。寬鬆(預設值)表示會嘗試 TLS 連線,但不需要成功;嚴格 表示需要 TLS 才能連線。

  • --ndb-mgmd-host

    命令列格式 --ndb-mgmd-host=連線字串
    類型 字串
    預設值 [無]

    --ndb-connectstring 相同。

  • --ndb-nodeid

    命令列格式 --ndb-nodeid=#
    類型 整數
    預設值 [無]

    為此節點設定節點 ID,覆寫由 --ndb-connectstring 設定的任何 ID。

  • --ndb-optimized-node-selection

    命令列格式 --ndb-optimized-node-selection

    啟用交易的節點選取最佳化。預設為啟用;使用 --skip-ndb-optimized-node-selection 停用。

  • --ndb-tls-search-path

    命令列格式 --ndb-tls-search-path=清單
    類型 路徑名稱
    預設值 (Unix) $HOME/ndb-tls
    預設值 (Windows) $HOMEDIR/ndb-tls

    指定要搜尋 CA 檔案的目錄清單。在 Unix 平台上,目錄名稱以冒號 (:) 分隔;在 Windows 系統上,分號字元 (;) 用作分隔符號。目錄參考可以是相對或絕對的;它可以包含一個或多個環境變數,每個變數都以首碼錢幣符號 ($) 表示,並在使用前展開。

    搜尋從最左邊的命名目錄開始,並從左向右繼續,直到找到檔案。空字串表示空的搜尋路徑,這會導致所有搜尋失敗。由單一點號 (.) 組成的字串表示搜尋路徑僅限於目前的工作目錄。

    如果沒有提供搜尋路徑,則會使用編譯的預設值。此值取決於使用的平台:在 Windows 上,此值為 \ndb-tls;在其他平台(包括 Linux)上,此值為 $HOME/ndb-tls。可以使用 -DWITH_NDB_TLS_SEARCH_PATH 編譯 NDB 叢集來覆寫此值。

  • --no-defaults

    命令列格式 --no-defaults

    不要從登入檔案以外的任何選項檔案讀取預設選項。

  • --print-defaults

    命令列格式 --print-defaults

    列印程式引數列表並結束。

  • --usage

    命令列格式 --usage

    顯示說明文字並結束;與 --help 相同。

  • --version

    命令列格式 --version

    顯示版本資訊並結束。

警告

使用 NDB API 對叢集資料表索引執行的操作,MySQL 看不到,並會使 MySQL 伺服器無法使用該資料表。 如果您使用此程式來刪除索引,然後嘗試從 SQL 節點存取該資料表,就會產生錯誤,如下所示

$> ./ndb_drop_index -c localhost dogs ix -d ctest1
Dropping index dogs/idx...OK

$> ./mysql -u jon -p ctest1
Enter password: *******
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7 to server version: 5.7.44-ndb-7.5.35

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> SHOW TABLES;
+------------------+
| Tables_in_ctest1 |
+------------------+
| a                |
| bt1              |
| bt2              |
| dogs             |
| employees        |
| fish             |
+------------------+
6 rows in set (0.00 sec)

mysql> SELECT * FROM dogs;
ERROR 1296 (HY000): Got error 4243 'Index not found' from NDBCLUSTER

在這種情況下,讓資料表再次可供 MySQL 使用的唯一選項是刪除資料表並重新建立它。您可以使用 SQL 陳述式DROP TABLEndb_drop_table 公用程式(請參閱第 25.5.11 節「ndb_drop_table — 刪除 NDB 資料表」)來刪除資料表。