1
mysql> alter table bill_item add  index idx_comp(created_date,product_id);
Query OK, 0 rows affected, 1 warning (1 min 2.62 sec)
Records: 0  Duplicates: 0  Warnings: 1

Trying to drop the index:

mysql> alter table bill_item drop index created_date;
ERROR 1091 (42000): Can't DROP 'created_date'; check that column/key exists
  • 1
    Hi, First of all, welcome to the site. There are a few problems with your question preventing answers. Please show all the code and table definitions and sample data. Please do the tour read through the help section to learn how this site works. especially how to ask a good question. You will attract more answers and useful feedback. – Tom V - try topanswers.xyz Aug 28 '15 at 9:26
  • 1
    You're confusing index name and column name. When you want to drop an index, use the index name. – tombom Aug 28 '15 at 10:10
  • The error mean that: You are trying to drop an index that doesn't exists. Check the column/key if that exists. . – Mr ASquare Apr 12 '17 at 5:38
2

If you want to drop the index that you created previously, the correct statement would be:

alter table bill_item drop index idx_comp;

created_date is the name of one of the columns in your table bill_item.

Note: To find the index name use SHOW INDEXES FROM <table> if you used a different naming convention than prepending 'idx_'

|improve this answer|||||
  • its not working same above.... alter table bill_item drop index idx_comp;.... error only ERROR 1091 (42000): Can't DROP 'created_date'; check that column/key exists – syed adamshafi Sep 1 '15 at 4:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.