Airo Dump Airo Dump - 2 months ago 32
MySQL Question

Data truncated for column

Hello im try to insert data from phpmyadmin on my table but i got error like this

1 row affected. Warning: #1265 Data truncated for column 'value' at row 1

for my talble is like this

`setting_id` int(11) NOT NULL,
`store_id` int(11) NOT NULL DEFAULT '0',
`group` varchar(32) COLLATE utf8_bin NOT NULL,
`key` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`value` text COLLATE utf8_bin NOT NULL,
`serialized` tinyint(1) NOT NULL

i try put around 5000 data and i can input around 2000 after it when i try insert its say error data truncate thanks.


Data truncated for column obviously means that your data is too wide to fit into the column specified. It's for the value field, which is of type text the text field can accomodate only 65K of data. You need a bigger type. Maybe MEDIUMTEXT which can accomodate 16MB of data.

BTW, since you are actually storing binary data in your column. MEDIUMBLOB might actually be a better option.

Last but not least :

With Web servers, store images and other binary assets as files, with the path name stored in the database rather than the file itself. Most Web servers are better at caching files than database contents, so using files is generally faster. (Although you must handle backups and storage issues yourself in this case.)