[thelist] Change mySql field size

Keith Gaughan kmgaughan at eircom.net
Wed Sep 7 19:33:18 CDT 2005

Bernardo Escalona-Espinosa wrote:

> I need to change the size of a field in one of my mySql databases.
> Right now i only allow visitors to my website to add comments that are
> 300 chars long, and i want to allow up to 1000.
> 1) I couldnt find a definite answer but i think the mySql command goes
> something like this:
> ALTER TABLE comments CHANGE comment_content text(1000);
> Does this look ok? Im still not very clear on the maximum size and
> trailing-space removal of TEXT-type fields.

If the field is already of type TEXT, you don't need to change it. TEXT
fields can store up to 64kB of text. You do not need to specify a size
with them.

The only text types that take a size are the VARCHAR and CHAR types,
which up to 5.0.3, could hold up to 255 characters, but now can store up
to 65535 bytes worth.

> 2) Will the existing contents of these fields be affected? My guess is
> probably not, but I just want to make sure.

It won't be affected.


More information about the thelist mailing list