You may be using a popular action for connecting with MariaDB and it may work fine for most of the retries. But it’s flaky because sometimes DB server is not ready for connections yet. I looked around for solutions. One was about changing table_open_cache
from 2000 to 400 but I skipped it. Other was from here and it worked for me: https://stackoverflow.com/questions/76940314/mariadb-container-not-starting-task-on-github. It is about making sure that the server is ready. Here’s the code with empty password:
jobs:
check:
runs-on: ubuntu-latest
services:
mariadb:
image: mariadb:10.6
ports:
- 3306:3306
env:
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: true
MARIADB_DATABASE: test_db
options: --health-cmd="healthcheck.sh --connect --innodb_initialized" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
...