Skip to content

Instantly share code, notes, and snippets.

@Telematica
Last active June 10, 2018 22:51
Show Gist options
  • Save Telematica/bfb2361ee28f3d73bf403afd1bb48c17 to your computer and use it in GitHub Desktop.
Save Telematica/bfb2361ee28f3d73bf403afd1bb48c17 to your computer and use it in GitHub Desktop.
MySQL Server SQL Modes

MySQL Server SQL Modes

Reference Topic:

Add Mode Settings Via Command line

SET 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";

Add Mode Settings Via Config file

Ubuntu 16.04: /etc/mysql/mysql.conf.d/mysqld.cnf

Strict Mode Enabled

[mysqld]
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"

* Basic Settings

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";

Remember to restart Mysql Services, and close old command line sessions, in order to see settings taking effect on CMD.

systemctl restart mysql

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment