MySQL: Don't execute query if test mode is enabled.

MySQL was executing query in test mode when output is not defined. Fixes #16756