Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set a varchar to have unlimited length?

Tags:

mysql

In a MySQL database, how would I set a varchar to have unlimited length, so that I can store long web pages? IF not , then what is the Maximum Size?

I know about Text Types to store larger strings. Is there any limitations on using test data type which i have to handle?

like image 933
Birlla Avatar asked Mar 31 '14 08:03

Birlla


2 Answers

VARCHAR can store upto 255 chars before MySQL 5.0.3 and 65,535 chars in 5.0.3 and later versions.

To store large data in Mysql database you can use

TEXT , MEDIUMTEXT , LONGTEXT

TEXT can store 65,535 characters (approx 64KB) MEDIUMTEXT = 16,777,215 characters (approx 16 MB)  LONGTEXT = 4,294,967,295 chars (approx 4GB) 
like image 179
Rupam Avatar answered Oct 04 '22 19:10

Rupam


You can try using varchar(max)

like image 40
HaydnJW Avatar answered Oct 04 '22 21:10

HaydnJW