每日bug --- mysql Data too long for column 'XX' at row 1

问题描述

添加表数据的时候,遇到了 Data too long for column ‘id’ at row 1 ,并且只是这个库有问题,其他的库里 的表经过测试,没有问题,可以正常的插入数据

解决问题的方案:
打开数据库的命令界面,输入下面的命令,我输完前 4个之后,问题解决


mysql> SET character_set_client = utf8 ;
mysql> SET character_set_connection = utf8 ;
mysql> SET character_set_database = utf8 ;
mysql> SET character_set_results = utf8 ;
mysql> SET character_set_server = utf8 ;

mysql> SET collation_connection = utf8 ;
mysql> SET collation_database = utf8 ;
mysql> SET collation_server = utf8 ;

错误出现的原因:应该是数据库的编码格式出现了紊乱
设置统一成 utf-8之后,就可以解决

发布了52 篇原创文章 · 获赞 11 · 访问量 2461

猜你喜欢

转载自blog.csdn.net/weixin_41705396/article/details/105203323