How to drop this index in MySQL?
It's created this way:
create table listings(
id integer unsigned NOT NULL AUTO_INCREMENT,
accountId integer unsigned default null,
title varchar(300) not null,
country integer unsigned,
region integer unsigned,
type integer unsigned,
price integer,
unit varchar(20) not null,
priceUSD decimal(12,2),
bedrooms integer unsigned,
thumbnail varchar(100) default null,
keywords text,
created datetime,
deleted boolean default 0,
fulltext index (keywords),
PRIMARY KEY (id)
) engine=MyISAM;
How to drop that fulltext index which has no name?
What if the un-named index is:fulltext index (title ,keywords)
?
ALTER TABLE listings DROP INDEX keywords;
Run this command in the mysql
client:
mysql> SHOW CREATE TABLE listings;
It will show you the DDL for the table, including the system-assigned name for the index.
ALTER TABLE {your_table_name} DROP INDEX {your_index_name}
OR
DROP INDEX {your_index_name} ON {your_tbl_name}
You can also get table index information using SHOW INDEX syntax.
SHOW INDEX FROM listings;
Also, when you don't provide a name for the index, MySQL will automatically provide a name for the index based on the column(s) being indexed.
For fulltext index (keywords)
, MySQL will most likely name the index keywords
.
For fulltext index (title ,keywords)
, MySQL will most likely name the index title
.
I say "most likely" because if there is already an index named keywords
or title
, MySQL will name it something else.