MySQL 9.7 changed the default gtid_mode from OFF to ON (since 9.5). When
the MySQL Docker container initialises, the init scripts run with
GTID=ON, leaving non-empty GTID_EXECUTED in the binary log even though
the final server starts with --gtid-mode=OFF.
This causes two problems:
1. mysqldump always includes SET @@GLOBAL.GTID_PURGED when cloning
test databases for parallel tests. Restoring this requires
SYSTEM_VARIABLES_ADMIN, which was not granted.
2. mysqldump requires PROCESS to dump tablespace information. While
PROCESS was being granted, SYSTEM_VARIABLES_ADMIN was missing
from the grants, causing clone failures (exit code 5) for Django
6.0's stricter parallel test runner.
Fix both issues by:
- Running RESET BINARY LOGS AND GTIDS before granting privileges,
which clears the GTID state left by the init phase so mysqldump
no longer emits GTID_PURGED statements.
- Adding SYSTEM_VARIABLES_ADMIN to the privilege grants so that if
any GTID state is present (e.g. in future MySQL versions), the
restore can set GTID_PURGED.
Signed-off-by: Stephen Finucane <stephen@that.guru> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>