How to set SQL modes for MySQL in a CircleCI container

In circle.yml you can add comma-separated sql-modes to /etc/mysql/my.cnf and then restart the mysql service, e.g.:

database:
  pre:
    - echo "[mysqld]" | sudo tee -a /etc/mysql/my.cnf
    - echo 'sql-mode="ALLOW_INVALID_DATES"' | sudo tee -a /etc/mysql/my.cnf
    - sudo service mysql restart