#1170 - BLOB/TEXT column 'urlname' used in key specification without a key length?

I’m using PHPMyAdmin

and I have this error,

#1170 - BLOB/TEXT column 'urlname' used in key specification without a key length 

This is the command I used,

ALTER TABLE  `finishedurls` ADD  `urlname` TEXT NOT NULL ,
ADD INDEX (  `urlname` )

Now How do I fix this?

Thanks in advanced.

specify a length

see http://dev.mysql.com/doc/refman/5.0/en/column-indexes.html

by the way, are you sure you want TEXT? TEXT is for, you know, big chunks of text, e.g. 200 kilobytes

an urlname sounds like it will easily fit into a modestly long VARCHAR, e.g. 200 bytes

Thanks rudy.
But try this forum URL above for example it already reached 130 characters.
So I guess TEXT is the safest way.
Because VARCHAR is too short.

no, it’s not :slight_smile:

before mysql version 5.0.3, VARCHAR had a maximum length of 255

subsequently, VARCHAR has a maximum length of 65,535