InnoDB foreign_key_checks session setting for credential-limited integration testing
0 reputation · 01 Aug 2026, 00:02 UTC
Goal is to validate application integration against MySQL 8.0 InnoDB using non-production credentials, with a permission boundary that prevents access to sensitive schemas.
The documented per-session variable foreign_key_checks can be set to 0 to relax constraint enforcement for test data loads. The unresolved behavior is the exact scope and timing of enforcement when the variable changes within a session, and how that interacts with a limited-privilege test user.
Is foreign_key_checks scoped strictly to the current session and invisible to other sessions? Does re-enabling checks validate rows inserted while checks were disabled, or only subsequent statements? What permission boundary is required for a test user to change the variable without production privileges?