Mysql MysqlDataTruncation Data truncation Data too long for column
2017-02-16 18:48
281 查看
一、问题描述
今天插入 Mysql 数据库时遇到以下错误Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'body' at row 1
插入的是富文本编辑器的内容,以上我的 body 列的类型是 text,以前编辑文章都能足够容纳文章内容。这个项目是使用 Vuejs 做的管理后台,编辑器用的是 vue-quill-editor,这个编辑器对图片的处理是把图片进行 Base64 编码到文本中,然后插入数据库的时候长度就超了。
二、解决方案
把数据库对应的列类型改为 mediatext 或 longtext 就可以了。三、相关知识
Mysql 相关字符类型的长度:TINYBLOB, TINYTEXT L + 1 bytes, where L < 2^8 (255 Bytes) BLOB, TEXT L + 2 bytes, where L < 2^16 (64 Kibibytes) MEDIUMBLOB, MEDIUMTEXT L + 3 bytes, where L < 2^24 (16 Mebibytes) LONGBLOB, LONGTEXT L + 4 bytes, where L < 2^32 (4 Gibibytes)
四、资料
《Maximum length for MySQL type text》《String Type Overview》
相关文章推荐
- MysqlDataTruncation: Data truncation: Data too long for column 'headimg' at row 1
- Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'content' a
- 数据库编码com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'sex' at row 1
- Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'content' at ro
- com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'title' at row 1
- Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'name' at r
- ssh框架中的错误:com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'user_name'
- com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'title' at row 1
- com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'title' at row 1
- Eexception is com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'PIC' at
- com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'title' at row 1
- com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'sex' at row 1”
- ### Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'articleTit
- ### Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column \'name\' at row 1
- mysql中存中文时出现“Data too long for column”
- Mysql 中ERROR 1406 (22001): Data too long for column 解决方法
- MySQL字符集 GBK、GB2312、UTF8区别 解决 MYSQL中文乱码问题以及error 1406:data too long for column 'name' at row 1
- mysql错误:data too long for column
- mysql建表时指定编码,避免Data too long for column.....的异常
- Mysql 中ERROR 1406 (22001): Data too long for column 解决方法