Eric
Eric

Reputation: 5215

Add or change comment for MySQL table or column?

I'm using phpMyAdmin 3.5.1. I did all the necessary instalation and configuration steps (created the special phpmyadmin database and tables, set up the pma user etc.). My phpMyAdmin seems to indicate that everything is set correctly.

My problem is I can't see how to add a comment to a table, or to a specific column. Where is that?

Upvotes: 16

Views: 16388

Answers (3)

evilReiko
evilReiko

Reputation: 20473

@trejder's answer is perfect for phpMyAdmin. For anyone looking for table comment in MySQL Workbench: When creating or editing a table, click on the downward arrow next to the table name and schema on the far top right, there you can view/edit the comment.

enter image description here

You can also view the comment by right-click on the table > Table Inspector, you will find it in the bottom.

enter image description here

Upvotes: 1

trejder
trejder

Reputation: 17495

A quick reference or check-list (for phpMyAdmin version 4.0.1):

a) table comment:

  • when creating new table: below columns list, Table comments field, next to Storage Engine,

  • when changing comment for existing table: Operations > Table options > Table comments.

b) column comment: always as one of last columns (Comments) in add / change columns view.

Note, that while column's comment length is unlimited (very long anyway; managed to add comment with 2000 characters), table's comment length is limited to only 60 characters (not quite much). I don't know, from where does this limitation come from (MySQL or phpMyAdmin), but it is surely odd and should be replaced -- in most cases, you have to write a much more comment for entire table than for one column.

Upvotes: 9

Sam Dufel
Sam Dufel

Reputation: 17598

Table comments are in the "operations" tab; column comments are via editing the column.

Upvotes: 29

Related Questions