Mysql max_allowed_packet configuration

This seems like something that should be obvious, but I haven’t been able to find anything. I’m inserting into a Mysql database and getting the ERROR 2006 (HY000) at line 163385: MySQL server has gone away error, which I’m pretty sure is because some packet in my database is too large for the default settings.

I want to increase the max_allowed_packet config on the database. I’ve tried the following, which does not appear to work:

    build:
        docker:
            - image: circleci/php:7.2-node
            - image: mysql:5.6
              name: "primary_test"
              environment:
                  - MAX_ALLOWED_PACKET=64M

I guess the next step is to create a my.cnf files and put it in the right spot, but that seems like overkill. Is there a container environment variable I can set to do this? And, how does one discover the available variables for a container? (teach a man to fish and all that)

Hi!

You can use the command tool to increase the max_allowed_package to… 64MB with this:

    tests: &tests
      docker:
        - image: my-main-image:latest
        - image: mariadb:10.3
          environment:
            MYSQL_ALLOW_EMPTY_PASSWORD: 1
          command: [--max-allowed-packet=67108864]

That’s for mariadb, and I guess it’s similar for mysql. Here is a command to be able to see all available commands:
docker run -it --rm mariadb:10.3 --verbose --help

Here are all options you can configure for a docker executor: https://circleci.com/docs/2.0/configuration-reference/#docker