vccw-team / vccw

A Vagrant based development environment.
http://vccw.cc/
MIT License
1.02k stars 181 forks source link

MySql Strict Mode Prevents Importing #240

Open Tiim opened 7 years ago

Tiim commented 7 years ago

Operating System: Windows 10 Vagrant Version: 1.9.2 Virtual Box Version: 5.1.14r112924

I just setup vagrant and vccw and tried to import a database dump from my production server via wp-cli. This unfortunately failed with the message Invalid default value for 'comment_date' datetime field. I googled this error and found that this was due to MySql strict mode, which apparently is on by default.

The fix for this, according to this website is to include the setting

sql_mode=ONLY_FULL_GROUP_BY,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION under the tag [mysqld]

in the file /etc/mysql/mysql.conf.d/mysqld.cnf

This fixed it for me, but do I have to repeat this every time a new vccw environment is set up? Or is it possible to disable the mysql strict mode by default?

miya0001 commented 7 years ago

Thanks for report!

I want to reproduce the problem.

Tiim commented 7 years ago

No problem.

Wordpress version: 4.7.3 MySQL version: 5.6.33 I did indeed use wp db import to import the database.