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 Link to comment https://forums.phpfreaks.com/topic/262217-add-a-comment-to-a-mysql-keyindex/ 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. Link to comment https://forums.phpfreaks.com/topic/262217-add-a-comment-to-a-mysql-keyindex/#findComment-1343766 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. Link to comment https://forums.phpfreaks.com/topic/262217-add-a-comment-to-a-mysql-keyindex/#findComment-1343767 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 Link to comment https://forums.phpfreaks.com/topic/262217-add-a-comment-to-a-mysql-keyindex/#findComment-1343769 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.