Documentation Home
MySQL 8.4 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 39.8Mb
PDF (A4) - 39.9Mb
Man Pages (TGZ) - 257.9Kb
Man Pages (Zip) - 364.9Kb
Info (Gzip) - 4.0Mb
Info (Zip) - 4.0Mb


MySQL 8.4 Reference Manual  /  ...  /  ndb_drop_index — Drop Index from an NDB Table

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

    Command-Line Format --character-sets-dir=路径

    包含字符集的目录。

  • --connect-retries

    Command-Line Format --connect-retries=#
    Type 整数
    Default Value 12
    Minimum Value 0
    Maximum Value 12

    连接重试次数,直到放弃。

  • --connect-retry-delay

    Command-Line Format --connect-retry-delay=#
    Type Integer
    Default Value 5
    Minimum Value 0
    Maximum Value 5

    连接管理服务器之间的等待秒数。

  • --connect-string

    Command-Line Format --connect-string=connection_string
    Type String
    Default Value [none]

    --ndb-connectstring相同。

  • --core-file

    Command-Line Format --core-file

    错误时写入核心文件;用于调试。

  • --database, -d

    Command-Line Format --database=name
    Type String
    Default Value TEST_DB

    表所在数据库的名称。

  • --defaults-extra-file

    Command-Line Format --defaults-extra-file=&path
    Type String
    Default Value [none]

    读取给定的文件,global 文件已经被读取。

  • --defaults-file

    Command-Line Format --defaults-file=&path
    Type String
    Default Value [none]

    从给定的文件中读取默认选项。

  • --defaults-group-suffix

    Command-Line Format --defaults-group-suffix=&string
    Type String
    Default Value [none]

    也读取concat(组,后缀)中的组。

  • --help

    Command-Line Format --help

    显示帮助文本并退出。

  • --login-path

    Command-Line Format --login-path=&path
    Type String
    Default Value [none]

    从登录文件中读取给定的路径。

  • --no-login-paths

    Command-Line Format --no-login-paths

    跳过从登录路径文件中读取选项。

  • --ndb-connectstring

    Command-Line Format --ndb-connectstring=connection_string
    Type 字符串
    Default Value [none]

    设置连接字符串,以连接到ndb_mgmd。语法:[nodeid=id;][host=]hostname[:port]。覆盖了NDB_CONNECTSTRINGmy.cnf中的条目。

  • --ndb-mgm-tls

    Command-Line Format --ndb-mgm-tls=level
    Type 枚举
    Default Value relaxed
    Valid Values

    relaxed

    strict

    设置连接到管理服务器所需的TLS支持级别;可以是relaxedstrictrelaxed(默认)意味着尝试建立TLS连接,但成功不必;strict意味着必须使用TLS才能连接。

  • --ndb-mgmd-host

    Command-Line Format --ndb-mgmd-host=connection_string
    Type String
    Default Value [none]

    --ndb-connectstring相同。

  • --ndb-nodeid

    Command-Line Format --ndb-nodeid=#
    Type Integer
    Default Value [none]

    为当前节点设置节点ID,override任何由--ndb-connectstring设置的ID。

  • --ndb-optimized-node-selection

    Command-Line Format --ndb-optimized-node-selection

    启用事务选择节点的优化。默认启用;使用--skip-ndb-optimized-node-selection来禁用。

  • --_ndb-tls-searc-path

    Command-Line Format --_ndb-tls-searc-path=list
    Type Path name
    Default Value (Unix) $HOME/ndb-tls
    Default Value (Windows) $HOMEDIR/ndb-tls

    指定搜索目录列表,以便查找CA文件。在Unix平台上,目录名称使用冒号(:)分隔;在Windows系统上,使用分号字符(;)作为分隔符。目录引用可以是相对或绝对的,可以包含一个或多个环境变量,每个变量以前缀美元符号($)表示,并在使用时展开。

    搜索从左侧命名目录开始,自左向右进行直到找到文件。空字符串表示空搜索路径,这将导致所有搜索失败。包含单个点字符(.)的字符串表示搜索路径限制于当前工作目录。

    如果未提供搜索路径,则使用编译时默认值。这取决于平台:在Windows上,这是\ndb-tls;在其他平台(包括Linux)上,这是$HOME/ndb-tls。可以通过编译NDB集群时使用-DWITH_NDB_TLS_SEARCH_PATH来覆盖默认值。

  • --no-defaults

    Command-Line Format --no-defaults

    不要从任何选项文件中读取默认选项,除了登录文件。

  • --print-defaults

    Command-Line Format --print-defaults

    打印程序参数列表并退出。

  • --usage

    Command-Line Format --usage

    显示帮助文本并退出;与--help相同。

  • --version

    Command-Line Format --version

    显示版本信息并退出。

Warning

使用 NDB API 进行 Cluster 表索引操作时,这些操作对 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.32

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

在这种情况下,您的唯一选择是将表格删除并重新创建它。您可以使用 SQL 语句DROP TABLEndb_drop_table实用工具(请参见第25.5.11节,“ndb_drop_table — Drop an NDB Table”)来删除表格。