问题
I am trying to insert a very long text string into a MySQL Blob column, but MySQL is only saving 64kB of the data. The string is 75360 characters long. I am connecting with PHP's mysql_connect().
Any ideas?
Does it make a difference if it's Blob or Text. I originally had it as a Text but changed it with no affect.
回答1:
Because that's the maximum size of a BLOB column. You need to use MEDIUMBLOB/LONGBLOB or MEDIUMTEXT/LONGTEXT.
回答2:
A BLOB type in MySQL can store up to 65,534 bytes, if you try to store more than this much data MySQL will truncate the data. MEDIUMBLOB can store up to 16,777,213 bytes, and LONGBLOB can store up to 4,294,967,292 bytes.
If you enable strict SQL mode (MySQL modes) you will get an error when you try to store data that doesn't fit in the column type.
回答3:
You also asked if there is a difference between BLOB and TEXT
BLOBS are for binary data. If you do a LIKE query on a BLOB field it will be case sensitive.
i.e.
SELECT 'TEXT' LIKE 'TEXT';
=> 1 for both BLOB and TEXT
SELECT 'TEXT' LIKE 'text';
=> 1 for TEXT
=> 0 for BLOB
回答4:
The blob column is only 64Kb per the documentation
Try a mediumblob column type instead...
来源:https://stackoverflow.com/questions/409761/why-is-only-64kb-of-data-being-saved-in-my-mysql-data-column