mysql5.x sql-mode 引起的错误

今天安装了个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”

This entry was posted in DataBase and tagged , , . Bookmark the permalink.

2 Responses to mysql5.x sql-mode 引起的错误

  1. wking says:

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

  2. admin says:

    感谢 wking, 已经修正.

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

*
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