MySQL image crashes

Hey,

I have the following problem: I wanna use a mysql image in circleci to run some tests with a dummy database. Unfortunately the image crashes with this message:

2021-10-31T11:24:10.640863Z 0 [Note] mysqld: ready for connections.
Version: '5.7.36'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL)
2021-10-31T11:24:15.070976Z 2 [Note] Got an error reading communication packets

Build was canceled

My config.yml:

version: 2.1

jobs:
  test:
    parameters:
      php-version:
        type: string
      typo3-version:
        type: string
      mysql-version:
        type: string

    docker:
      - image: circleci/php:<< parameters.php-version >>-cli-node-browsers

      - image: mysql:<< parameters.mysql-version >>
        environment:
          MYSQL_ROOT_PASSWORD: root
          MYSQL_DATABASE: typo3
          MYSQL_USER: user
          MYSQL_PASSWORD: passw0rd

    steps:
      - checkout
...
      - run:
          # Our primary container isn't MYSQL so run a sleep command until it's ready.
          name: Waiting for MySQL to be ready
          command: |
            wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && sudo tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
            dockerize -wait tcp://localhost:3306 -timeout 1m
            sudo apt-get install default-mysql-client
            mysql -u user -ppassw0rd < show_db.sql
          environment:
            DOCKERIZE_VERSION: v0.3.0
...
workflows:
  all-tests:
    jobs:
      - test:
          matrix:
            parameters:
              php-version: [ "7.4", "8.0" ]
              typo3-version: [ "^10.4", "^11.5" ]
              mysql-version: ["5.7"]
            exclude:
              - php-version: "8.0"
                typo3-version: "^10.4"
                mysql-version: "5.7"

The mysql command fails, because the mysql image is gone already.

Does someone have an idea?

In the config above you are not using the CircleCI MySQL image, so this is the best place to start. Try switching to circleci/mysql as per the examples here:

https://circleci.com/docs/2.0/postgres-config/#example-mysql-project

1 Like

Yes you are right, but I tried both (to be honest the circleci/mysql first) with the same result: