Using SQL Server you just have to give the "MAX" parameter to the length of a text data type, but in MySQL there's no such a thing.

According to Ispirer:

"n" is the maximum number of characters, optional

Range: 1 ⇐ n ⇐ 21845 (65535 bytes is the maximum row size shared among all columns)

Does it mean that:


Or do i have to say NVARCHAR(21845) as NVARCHAR(MAX) in MySQL?

2 Answers 2


According to this MySQL document the LONGTEXT datatype in MySQL is 4 Gigabytes.


Note that the number of characters depends on the encoding.

  • Is Longtext better than NVARCHAR to store text as html or xml? Apr 20, 2015 at 2:53
  • I would not think so. But why the question? If you are using MySQL then use LONGTEXT, but if you are using MS SQL Server then use VARCHAR (MAX). I would not choose the server platform based on this issue, but would choose to stick to my current environment unless there was real reason to change.
    – RLF
    Apr 23, 2015 at 13:44

TEXT (max of 64K bytes) or MEDIUMTEXT (max 16M bytes) is typically used. There is no 'max' after them.

VARCHAR(1111) is like NVARCHAR; the 1111 is the limit on characters (not bytes). VARCHAR is limited to 64K characters.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.