Mud Hut
Mud Hut

Reputation: 645

How can I set maximum character length in mysql

I am using mysql database, i want to use the varchar field with no limit. i.e i want to use the varchar field for any number of characters, how can i do this?

Upvotes: 1

Views: 1478

Answers (3)

PermGenError
PermGenError

Reputation: 46438

use Text instead of Varchar. check it here

Upvotes: 0

Keith Smiley
Keith Smiley

Reputation: 63994

The varchar field specifically is not meant for unlimited length if you can fit your data within 255 characters do that otherwise you can use the text field instead.

Read more about this from this question

Upvotes: 0

Bohemian
Bohemian

Reputation: 425418

Use the text type. It is effectively unlimited. eg

create table mytable (
    mycol text
);

Upvotes: 2

Related Questions