首页 > DataBase > mysql5.x sql-mode 引起的错误

mysql5.x sql-mode 引起的错误

2008年11月24日
1,104 views 评论 发表评论

今天安装了个mysql5.0,拿了一个很久之前网上下的程序检查一下是否工作正常.

发现以前的程序居然不能正常运行,提示信息如下:
Database error: Invalid SQL: INSERT INTO Survey_UserHistory(userId,jobId,type,action,startTime,endTime) VALUES(’17′,”,’User’,'Login’,”,’2008-11-23 14:33:56′)
MySQL error: 1366 (Incorrect integer value: ” for column ‘jobId’ at row 1)
Session halted.

第一时间的反应是跟mysql5.0新加的sql-mode有关系,因为前一阵子刚刚看过手册.果然,作了如下更改后就不再提示了.

修改 my.ini 文件.

# Set the SQL mode to strict
sql-mode=”STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION”

改为:

# Set the SQL mode to strict
sql-mode=”NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION”

DataBase , ,

  1. 2009年5月22日23:55 | #1

    是修改MYSQL的my.ini,不是修改PHP的php.ini文件。

  2. admin
    2009年5月25日00:41 | #2

    感谢 wking, 已经修正.

  1. 目前还没有任何 trackbacks 和 pingbacks.

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word