MySQL之Field‘***’doesn’t have a default value错误解决办法
2016-04-30 00:00
555 查看
首先排查一下数据库中对应的字段是不是设置为不能为空,以致数据插入不进去。我的就是这个原因解决的。
下面,整理一下网上的相同问题的其他解决办法,方便出现问题的同学参考:
1、打开my.ini,查找
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
修改为
sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
然后重启MYSQL
2、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.
3、看看你的数据库定义的时候是不是把主键生成方式设置为int的,但是没有设置为自增的!!或者数据定义的时候设置一个默认值就可以了。
ps:
http://www.jb51.net/article/63554.htm
下面,整理一下网上的相同问题的其他解决办法,方便出现问题的同学参考:
1、打开my.ini,查找
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
修改为
sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
然后重启MYSQL
2、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.
3、看看你的数据库定义的时候是不是把主键生成方式设置为int的,但是没有设置为自增的!!或者数据定义的时候设置一个默认值就可以了。
ps:
http://www.jb51.net/article/63554.htm
相关文章推荐
- 测试验证mysql开启binlog_rows_query_log_events参数前后的比较
- Servlet & JSP - getParameter 与 request.getAttribute 的区别
- error LNK2005: __pRawDllMain already defined in UiPlugin.obj
- POJ-2533 Longest Ordered Subsequence ( DP )
- reveal使用
- stack queue deque 用法
- leetcode 60. Permutation Sequence
- IOS学习 绘图 UIBezierPath 绘饼状图
- Android_UI控件:ListView 属性+使用+优化+Header+Footer+单选+多选+全选+setEmptyView (View emptyView)
- 后缀数组 POJ 3581 Sequence
- IOS学习 绘图 UIBezierPath 绘基本图形、样式设置、渲染填充
- FOJ 1914 Funny Positive Sequence
- POJ 1679 The Unique MST(次小生成树)
- leetcode60-Permutation Sequence(求指定位置的排列)
- Percona 工具 pt-query-digest的使用
- HDU 1242 Rescue(BFS+【优先队列】)
- poj 3080 Blue Jeans
- UINavigationItem和UItabBarItem的区别详解
- “UITableView完美平滑滚动”阅读笔记
- hiho 60. Permutation Sequence