10

MySQL Error "Incorrect integer value" for column 'name' at row 1″解决...

 3 years ago
source link: https://idealclover.top/archives/319/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

MySQL Error "Incorrect integer value" for column 'name' at row 1″解决方法

2017.11.06 | 零零碎碎 | 1977 浏览 | 0 赞 | 0 条评论


请注意,本文编写于 1478 天前,最后修改于 932 天前,其中某些信息可能已经过时。

在使用 typecho 的插件时遇到了数据库的错误,通过日志回溯之后发现错误原因是 MySQL Error "Incorrect integer value" for column '' at row 1,仔细查了一下。

主要的坑在于 sql_mode 的值,MySQL 5.5 中 sql_mode 默认值为 '', MySQL 5.6 (貌似是为了增加安全性),将 sql 默认值定为 NO_ENGINE_SUBSTITUTION,于是原来的程序 sql 语法不严谨就会出现报错。

处理的方法有两种:

一种是使用 SET 命令,在 MySQL 的命令行中输入

mysql> SET GLOBAL sql_mode = '';

坏处似乎是每次重新启动都需要重新设置。

另一种是修改 my.cnf 文件,在 my.cnf 配置文件中添加

sql_mode=NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

保存文件,重启 MySQL 服务。

https://dev.mysql.com/doc/refman/5.5/en/sql-mode.html
https://dev.mysql.com/doc/refman/5.6/en/sql-mode.html
https://www.devside.net/wamp-server/mysql-error-incorrect-integer-value-for-column-name-at-row-1
http://linux.it.net.cn/m/view.php?aid=21124

本文链接:https://idealclover.top/archives/319/

本作品由 idealclover 采用 知识共享署名 - 非商业性使用 - 相同方式共享 4.0 国际许可协议 进行许可,转载请注明出处。

标签: mysql, typecho, sql, set


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK