Jordan's answer is not exhaustive either.
SET timestamp=1376020745;
# administrator command: Init DB;
# User@Host: xxxx[xxxx] @ web-xxxx.private [10.x.x.x]
# Thread_id: 8343655 Schema: xxxx QC_hit: No
# Query_time: 3.179482 Lock_time: 0.000000 Rows_sent: 1 Rows_examined: 1
I thought it might be doable by looking for a line that starts with '#' which follows a line which does not start with '#', but there can be comments inside a query.
It's very much an edge case, but a query that is followed by a comment is likely to also fail, as the semi-colon is not last.
I wonder if mysql has any special handling for comments like '# Time: foo' that are passed within queries.
... View more