Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the maximum range of varchar in MySQL?

What is the maximum range of varchar in MySQL?

I am using the latest version of MySQL and in many sites it is being told that the size is 255. But when i am trying to give a higher size like 500 or 1000, it works for me. So is there a maximum number for varchar datatype?

like image 701
Deviprasad Das Avatar asked May 06 '11 06:05

Deviprasad Das


1 Answers

It was 255 before 5.0.3, but now:

Values in VARCHAR columns are variable-length strings. The length can be specified as a value from 0 to 65,535.

The documentation of 5.0.x shows the transition:

Values in VARCHAR columns are variable-length strings. The length can be specified as a value from 0 to 255 before MySQL 5.0.3, and 0 to 65,535 in 5.0.3 and later versions.

like image 134
Bozho Avatar answered Nov 16 '22 04:11

Bozho