Search code examples
mysqlindexingalter

mysql index creating issue


I have deleted all the data from an existing table and then trying to alter table using the following query in mysql:

 ALTER TABLE mytable ADD INDEX (created_on);

but nothing seems to working, it just keep running with out any result.


Solution

  • Here is a correct way to add an index:

    create index idx_mytable_createdon on mytable(created_on);