The Letter E Posted May 7, 2012 Share Posted May 7, 2012 I have scoured the internets for the information I seek and tried the most logical conventions I could think of to achieve the desired results, to no avail. Here's the problem... I want to add a comment to my indexes for different columns. so when I run the following line in mysql show indexes from tableName; I will see some data in the Comment field +----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | <----- last field in result set +----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+ | listings | 0 | PRIMARY | 1 | id | A | 0 | NULL | NULL | | BTREE | | | listings | 1 | user_id | 1 | user_id | A | 0 | NULL | NULL | YES | BTREE | | I have no idea how to add a comment to a key, whether it be on create index, alter table, or create table methods. Any help is greatly appreciated. Thanks, E Quote Link to comment Share on other sites More sharing options...
The Letter E Posted May 7, 2012 Author Share Posted May 7, 2012 In the mysql docs, it says you should be able to provide a COMMENT 'string' as and index_option, but that is returning a syntax error in my terminal. I tried: create index search on table_name(table_column) comment 'test'; no luck yet. Quote Link to comment Share on other sites More sharing options...
Jessica Posted May 7, 2012 Share Posted May 7, 2012 I think you have to put it on the column, not the index. Quote Link to comment Share on other sites More sharing options...
The Letter E Posted May 7, 2012 Author Share Posted May 7, 2012 I think you have to put it on the column, not the index. Thanks for the response. I just figured out the problem. Index comments are not available in my current mysql version, 5.1. I need to upgrade to 5.5. http://dev.mysql.com/doc/refman/5.5/en/create-index.html Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.