Symfony4 / Docker: SQLSTATE[HY000] [2002] Connection refused Symfony4 / Docker: SQLSTATE[HY000] [2002] Connection refused docker docker

Symfony4 / Docker: SQLSTATE[HY000] [2002] Connection refused


I solved it by doing:

  • downgrade to mysql 5.7
  • remove command: ["--default-authentication-plugin=mysql_native_password"] from docker-compose.yml
  • harcoding credentials in DATABASE_URL in .env file, and referencing "mysql" (service name from docker compose) instead of 127.0.0.1
    • DATABASE_URL=mysql://sf4user:sf4password@mysql:3306/sf4