1.OperationalError: (2006, "MySQL server has gone away (error(32, 'Broken pipe'))")
在一个查询中传递的数据过大,导致 error: 2006 MySQL server has gone away
--方法1.这种情况下可以通过设置mysql的配置文件my.cnf文件修改下面的选项来修复:
max_allowed_packet=64M
--方法2.查看默认参数值
mysql> show global variables like 'max_allowed_packet';
--修改参数:
mysql> set global max_allowed_packet=1024*1024*400;
mysql> show global variables like 'max_allowed_packet';
--参看:
--http://outofmemory.cn/code-snippet/1778/error-2006-MySQL-server-has-gone-away-resolve-method
--https://blog.csdn.net/abc200941410128/article/details/80198958
--http://blog.chinaunix.net/uid-24258-id-3131284.html
--http://www.ttlsa.com/mysql/mysql-server-has-gone-away-error-2006/
--https://www.2cto.com/database/201503/381103.html
--https://www.cnblogs.com/endige/archive/2012/04/11/2442534.html
2.ERROR 1067 (42000): Invalid default value for 'created_at'
-- 在创建表的时候遇到了Invalid default value for 'created_at'的错误,不知道什么原因造成的。
-- 默认数据使用“0000-00-00 00:00:00”报错,使用“1970-01-01 00:00:00”也同样报错。
CREATE TABLE `stu` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated_at` timestamp NOT NULL DEFAULT '1970-01-01 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- 解决方法:首先用下面的命令看下sql_mode
mysql> show variables like 'sql_mode';
-- 如果查询的结果如下:
ONLY_FULL_GROUP_BY, STRICT_TRANS_TABLES, NO_ZERO_IN_DATE, NO_ZERO_DATE, ERROR_FOR_DIVISION_BY_ZERO, NO_AUTO_CREATE_USER, NO_ENGINE_SUBSTITUTION
-- 如果结果中含有NO_ZERO_IN_DATE, NO_ZERO_DATE,则执行下面的命令:
mysql> set session sql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO'
-- 参考:https://blog.csdn.net/ch5057997/article/details/78540837
-- 参考:https://blog.csdn.net/qq_26245325/article/details/78916363
-- 参考:https://blog.csdn.net/qq_27229113/article/details/80176489
3.如何解决安装MySQL后没有 my.ini 本地配置文件
https://blog.csdn.net/wm3tcw28/article/details/78942693
https://www.cnblogs.com/RayWang/p/9347874.html
https://www.jb51.net/article/135903.htm