How to set a varchar to have unlimited length?

前端 未结 5 701
一整个雨季
一整个雨季 2021-02-01 15:10

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 Ty

5条回答
  •  滥情空心
    2021-02-01 15:58

    you should try this method: refer this link:

    MySQL - How to increase varchar size of an existing column in a database without breaking existing data?

    alter table table_name modify col_name varchar(10000)
    

    ALTER TABLE `table_name`
       CHANGE COLUMN `col_name` `col_name` VARCHAR(10000);
    

    or otherwise you should use this method:

    TEXT can store 65,535 characters (approx 64KB)
    MEDIUMTEXT = 16,777,215 characters (approx 16 MB) 
    LONGTEXT = 4,294,967,295 chars (approx 4GB)
    

提交回复
热议问题