您的位置:首页 > 产品设计 > UI/UE

Field 'id' doesn't have a default value 这个错误完美解决

2016-05-10 10:03 555 查看
1.Field 'id' doesn't have a default value

2.Field 'id' doesn't have a default value

程序启动的时候出现这个是因为一个非常幼稚的错误,认真观察自己的数据库有没有主键和自增加了没有!!!!!!!!!!!!!!!!!

本博主遇到这个问题的时候百度了一下

解决方法一:
打开my.ini,查找
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
修改为
sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
然后重启MYSQL
解决方法二:
MySQL 5 uses a strict mode which needs to be disabled.
In Windows, Goto Start-->Programs-->MySQL->MySQL Instance Config Wizard. Follow through the Reconfigure Instance option-->Detailed Configuration-->Continue Next a few screens. At the bottom under Enable TCP/IP option there is 'Enable Strict Mode'. Deslect this option (no tick). Save changes and MySQL will restart.
这些办法都是不行的,只有本博主的方法才有用,已自测通过。

如果有用请帮忙点个赞吧。。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  java 数据库