2

I would like to know in MySQL what is the maximum size is for a MySQL VARCHAR type.

I set varchar(2500), but it's not taking data more that this limit I think. I increased size to varchar(5000) but it's not taking. Which datatype should I use for larger text?

I got warning message:

Warning: #1265 Data truncated for column 'custom field value' at row 1

halfer
  • 19,824
  • 17
  • 99
  • 186
Anil Singh
  • 100
  • 1
  • 9

5 Answers5

1

Your problem is not VARCHAR, which goes to 65k. Show us your code and we can help you figure out where the truncation is occurring.

egrunin
  • 24,650
  • 8
  • 50
  • 93
0

Values in VARCHAR columns are strings length. 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. The effective maximum length of a VARCHAR in MySQL 5.0.3 and later is subject to the maximum row size (65,535 bytes, which is shared among all columns) and the character set used`.

for more string length you can use Text

Vivek Singh
  • 2,453
  • 1
  • 14
  • 27
0

Read: https://dev.mysql.com/doc/refman/5.0/en/char.html

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.

For long texts you maybe should use blob: https://dev.mysql.com/doc/refman/5.0/en/blob.html

Florian
  • 2,796
  • 1
  • 15
  • 25
0

https://dev.mysql.com/doc/refman/5.0/en/char.html

and for better practice you need to use TEXT instead for bigger text

mustafa96m
  • 329
  • 3
  • 16
0

take the data type "TEXT" for large data, try this once

Neelesh
  • 193
  • 1
  • 12