MySQL TEXT field size length limit reminder, don't truncate your data!

I thought there would be an error message or warning from MySQL in the case that the text you submit is greater than the allowed limit based on the field.

So essentially I submitted text that was about 120,000 characters long, whereas the limit of TEXT is just 65,535 characters!  I almost lost half of my data/what I typed without knowing it!

I just altered the field type in my database from TEXT to LONGTEXT.  I can't see how LONGTEXT wouldn't be long enough for MOST users and uses, which is basically 400 Million characters long.

Or if you want the middle ground choose MEDIUMTEXT at a length of 16 Million characters.

This is really something not to overlook, especially if you are entering a lot of text/copying and pasting server logs etc..

Here are the different limits of the MySQL text fields:

TINYTEXT
   
    A BLOB or TEXT column with a maximum length of 255 (2^8 - 1) characters


TEXT
   
    A BLOB or TEXT column with a maximum length of 65535 (2^16 - 1) characters

MEDIUMTEXT
   
    A BLOB or TEXT column with a maximum length of 16777215 (2^24 - 1) characters


LONGTEXT
   
    A BLOB or TEXT column with a maximum length of 4294967295 (2^32 - 1) characters


Tags:

mysql, text, length, reminder, truncate, submit, essentially, submitted, characters, whereas, typed, altered, database, longtext, wouldn, users, mediumtext, overlook, copying, pasting, server, logs, etc, fields, tinytext, blob, column, maximum,

Latest Articles

  • Why SMART is not smart at all and doesn't properly predict disk errors that cause a kernel panic or crash
  • scp: ambiguous target error and solution
  • VirtualBox How To Add iSCSI Storage using VBoxManage
  • iSCSI on Centos 7 Configuration and Setup Guide for Initiator and Target
  • Python and BeautifulSoup4's BS4's Decompose Method To Remove Unwanted Inner Tags
  • httpd AH00534: httpd: Configuration error: No MPM loaded. solution
  • bash script to remove modules from httpd.conf that are not actually installed
  • bash scripting how to create a function
  • Centos 7 PHP MySQL Not Working Solution
  • Bash How To Cut or Split Natively And Get The LAST Field
  • Bash Script How To Manipulate Text/Strings By Searchig and Replacing Natively
  • How Does Cisco CUCM (Cisco Unified Communication Manager) Work?
  • What DNS Options Does Active Directory Offer in Windows Server 2008,2012,2016 ?
  • syntax error, unexpected T_SL in PHP Solution
  • grep regular expression match number range between specific numbers
  • bash how to print out lines of text within a range from the first occurrence
  • bash script how to to check LAN computers for open ports
  • MySQL Using mytop Debug Source of High IO and Slow Performance
  • How To Mathematically Convert and Calculate Binary Value To Decimal Value
  • systemd management using systemctl and journalctl to check systemd logs