test表有个索引idx_b
点击(此处)折叠或打开
- mysql> show create table test\G
- *************************** 1. row ***************************
- Table: test
- Create Table: CREATE TABLE `test` (
- `a` int(11) NOT NULL DEFAULT '0',
- `b` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- KEY `idx_b` (`b`)
- ) ENGINE=ndbcluster DEFAULT CHARSET=utf8
- 1 row in set (0.00 sec)
在管理节点删除索引:
点击(此处)折叠或打开
- [mysql@station-192-168-20-80 mysql]$ ndb_drop_index -c 192.168.21.24 test idx_b -d test
- Dropping index test/idx_b...OK
- NDBT_ProgramExit: 0 - OK
点击(此处)折叠或打开
- mysql> show create table test\G
- *************************** 1. row ***************************
- Table: test
- Create Table: CREATE TABLE `test` (
- `a` int(11) NOT NULL DEFAULT '0',
- `b` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- KEY `idx_b` (`b`)
- ) ENGINE=ndbcluster DEFAULT CHARSET=utf8
- 1 row in set (0.00 sec)
- mysql>
点击(此处)折叠或打开
- mysql> drop index idx_b;
- ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
- mysql>
官方文档中的描述:
In such a case, your only option for making the table available to MySQL again is to drop the table
and re-create it. You can use either the SQL statement DROP TABLE or the ndb_drop_table utility
to drop the table.
In such a case, your only option for making the table available to MySQL again is to drop the table
and re-create it. You can use either the SQL statement DROP TABLE or the ndb_drop_table utility
to drop the table.
这种情况只能drop掉这个表并重建,才能访问。当然如果表中有数据也会丢失。
目前删除索引,只能在sql节点使用drop命令删除,不知道这是mysql的bug还是就是这样设计的,不理解!