Manual:$wgDebugDumpSql

Details
If true, SQL statements are dumped to the $wgDebugLogFile (debug log).

If $wgDebugComments is true, the Sql queries are dumped to the html output.