Manual:$wgDebugDumpSql

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

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