Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用MySQL5.7创建表时有报"Error 1067: Invalid default value for 'expires_at'"的解决办法 #1

Open
drone789 opened this issue Dec 26, 2018 · 0 comments

Comments

@drone789
Copy link

假如没有使用bobo老师实验中的MySQL5.6 ,而是使用了5.7及以上,可能报Error 1067: Invalid default value for 'expires_at'

问题解析:是高版本的SQL模式默认不允许NO_ZERO_IN_DATE,NO_ZERO_DATE,如下:
mysql> show variables like 'sql_mode' ;
+---------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| Variable_name | Value |
+---------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| 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 |
+---------------+-------------------------------------------------------------------------------------------------------------------------------------------+

可以通过:
SET GLOBAL sql_mode = '';
然后,重新来一遍数据库导入。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant