Please include this healthcheck:
healthcheck: test: ["CMD", "mysql", "-h", "db", "-u", "root", "-p${MYSQL_ROOT_PASSWORD}", "-e", "SELECT 1;"]
Note I have used the db service here.
I was struggling with the error: 'RuntimeError: 'cryptography' package is required for sha256_password or caching_sha2_password auth methods'