Home >Database >Mysql Tutorial >5.0.17以后版本的mysql对‘'和null的处理_MySQL

5.0.17以后版本的mysql对‘'和null的处理_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-01 13:37:56941browse

bitsCN.com


5.0.17以后版本的mysql对‘'和null的处理

 

MySQL升级到5.0.17后,在执行sql语句 

insert INTO `表名` ( ) VALUES ( ); 

时出现错误:      

#1264 - Out of range value for column ‘’ at row 1 

原因:新版本的MySQL对字段的严格检查。(使用了auto_increment ) 

 

解决方法: 

修改my.ini,将 

sql-mode=”STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION” 

改为 

sql-mode=”NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION”。 

重新启动MySQL。 

 

Linux 下是改 /etc/my.cnf ,可能没有sql-mode, 

 

可在[mysqld] 下加 sql-mode=”NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION” 

 

用 mysql> SELECT @@sql_mode;查询当前模式。

 

bitsCN.com
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn