Skip to content

Instantly share code, notes, and snippets.

@jimmyadaro
Created June 11, 2021 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimmyadaro/f3256d1aac5891f94aed841879afe735 to your computer and use it in GitHub Desktop.
Save jimmyadaro/f3256d1aac5891f94aed841879afe735 to your computer and use it in GitHub Desktop.
Remove "ONLY_FULL_GROUP_BY" from SQL mode in Docker MySQL

We should simply mirror a local config file to the MySQL config directory in Docker

File: ./docker-compose.local.yml (or however you name it)

services: 
  # [...]
  mysql:
      # [...]
      image: mysql:5.7
      # [...]
      volumes:
        # [...]
        - "./config/mysql/my.cnf:/etc/mysql/my.cnf"
      # [...]
      # Etc.

File: ./config/mysql/my.cnf (relative to your Docker Composer file)

[mysqld]
# Here we removed "ONLY_FULL_GROUP_BY"
sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment