I also had this issue, the solution that I found was to change your my.cnf or my-default.cnf in your server. For my case, I am using mac, this file can be found at /usr/local/mysql/support-files/
Steps to produce solution:
- Open Terminal
cd /usr/local/mysql/support-files/
sudo vim my.cnf
- scroll all the way to the bottom and press i to insert
- replace the existing slq_mode with
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
- press esc to exit input mode
- type
:wq
to save and close vim
- now restart your mysql with
sudo /usr/local/mysql/support-files/mysql.server restart
or sudo service mysql restart
- All done and you are set to enjoy your coding. Have fun :)
For some who couldn't find their my.cnf file. Please refer to this for Mark B answer. This will help you to find your my.cnf .
If you only have my-default.cnf, you could just copy it to ~/.my.cnf with the command sudo cp /usr/local/mysql/support-files/my-default.cnf ~/.my.cnf
and remember to restart after that.