Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL Text Column being truncated

Tags:

mysql

I have a MySQL database in which I am storing a bunch of textual info into a Text field in the database. The columns is

Name: info
Type: text
Collation: utf8_general_ci

I had a user insert ~64kb of information into the field and it freaks out. It will truncate the last 3 characters off. Which in this case happen to be the ending to a tab so it screws up everything after it on the page. If I manually go into the database and remove a couple letters and add the back then next time I go to edit it those last 3 will be removed again.

phpmyadmin is stating that the field is to long and may not be editable. So I tried to edit it on my cms page and I still recieved the same result.

Are there any known problems with this much data in a single database text column in mysql? It does not seems like there should be.

like image 924
corymathews Avatar asked Aug 28 '09 13:08

corymathews


People also ask

Why is My data truncated?

In databases and computer networking data truncation occurs when data or a data stream (such as a file) is stored in a location too short to hold its entire length.

What is truncation in MySQL?

TRUNCATE TABLE empties a table completely. It requires the DROP privilege. Logically, TRUNCATE TABLE is similar to a DELETE statement that deletes all rows, or a sequence of DROP TABLE and CREATE TABLE statements. To achieve high performance, TRUNCATE TABLE bypasses the DML method of deleting data.

What is Data truncated for column?

Truncated means “cut short”, and “data truncated” warnings or errors refer to a value's data being cut off at the end during the importing process (e.g. a value of “2.9823” being imported as “2.98”). These errors are important warnings, because it notifies us that our data has not been imported accurately.


1 Answers

You've got to remember that the TEXT has a Max of 65,535 characters. If your content exceeds 64K bytes it possible you are exceeding the limit of the field charaters. I suggest changing your column type to MEDIUMTEXT or LONGTEXT and see if that solves your problem.

like image 185
Steve Obbayi Avatar answered Nov 09 '22 19:11

Steve Obbayi