Don't execute query if test mode is enabled.

Fixes 16756
Merge pull request #16932 from bahadir/bug-mysql-test-mode

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