fix: add database name to MySQL connection test in health check

The MySQL connection test was failing because it didn't specify the
database name. MySQL requires a database to be selected when using
the -e flag with SELECT queries.

Changed:
mysql -u"$MYSQL_USER" -e 'SELECT 1'

To:
mysql -u"$MYSQL_USER" "$MYSQL_DATABASE" -e 'SELECT 1'

This fixes the "Impossible de se connecter à MySQL" error in production
even when MySQL is working correctly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
BeauTroll
2025-12-18 02:42:09 +01:00
parent e055d708a5
commit bd1e2dca27

View File

@@ -138,7 +138,7 @@ if docker-compose exec -T db mysqladmin ping -h localhost --silent 2>/dev/null;
source .env source .env
set +a set +a
if docker-compose exec -T db sh -c "MYSQL_PWD=\"\$MYSQL_PASSWORD\" mysql -u\"\$MYSQL_USER\" -e 'SELECT 1' >/dev/null 2>&1"; then if docker-compose exec -T db sh -c "MYSQL_PWD=\"\$MYSQL_PASSWORD\" mysql -u\"\$MYSQL_USER\" \"\$MYSQL_DATABASE\" -e 'SELECT 1' >/dev/null 2>&1"; then
check_ok "Connexion MySQL fonctionnelle" check_ok "Connexion MySQL fonctionnelle"
else else
check_fail "Impossible de se connecter à MySQL" check_fail "Impossible de se connecter à MySQL"