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

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


  • Linux Mint 18 Screen Goes Dark or Black After Screensaver or even when using the Desktop Solution
  • iptables guide and examples and howto
  • Postfix How To Change Sending IP Address To Specific IP Binding or Interface
  • How to qemu-kvm enable bridged networking in Debian Ubuntu Linux Mint on KVM containers
  • VirtualBox Nested Virtual Machine Containers with KVM Not Working no SVM or VMX module in the guest
  • VSphere InternalServerError - Error When Adding Permissions
  • NFS Share Won't Mount Solution - mount: wrong fs type, bad option, bad superblock on 10.10.2.20:/tmp/nfsmount
  • OVF Tool: Error: Task failed on server: This host does not support Intel VT-x. VMWare VCenter install On ESXi ERror
  • Install NFS (Network File System) On Debian Linux Ubuntu Mint Howto
  • Relocating modules and starting up the kernel - VMWare ESXi 6.7 Error and Solution
  • VMWare 6.7 VCSA VSphere ESXi Management SSO Install Guide on Linux using the CLI
  • Hard Drive Serial Number Examples
  • vino server error cannot login
  • OpenVPN auth-user-pass-verify ENV script error
  • OpenVPN error ERROR: Cannot ioctl TUNSETIFF tun: Operation not permitted (errno=1)
  • Howto install ioncube loader to PHP by Zend
  • Cannot create gradle for conversations
  • not allowed to execute '/usr/bin/apt-get install eclipse' as root linux sudo user permisson issue and solution
  • Database Error One or more of the WHMCS database tables appear to be either missing or corrupted. Please check and repair. - WHMCS Solution
  • postfix errors fatal: no SASL authentication mechanisms /usr/libexec/postfix/smtpd: bad command startup -- throttling solution