Can I get the history of MySQL queries?

I want to know the list of queries I ran lately, how can I do such a thing?
Thank you.

Don’t think this is possible - there might be a way to enable logging but I know that it isn’t done by default :slight_smile:
Why would you want such a thing? Surely it would be full of queries made from web programs?

I know that list gonna be huge. However, just like a log file for your site! You could also know in case some weird input you do.

Anyway, since James is not sure, could anyone tell me?
Since in “show status;”, we could see the number of questions (# of queries). But how to get the list of these queries, or the server doesn’t even log them?

I would log them to a text file, an excellent way to rebuild after any major setback, just save the SQLquery string to file along with a timestamp whenever you make the SQL call.

And no, I do not think that you can get this info from MySQL itself.

So the server doesn’t log queries?
Since the queries my scripts execute are not that dangerous. What about the situation when someone could login and send information (secretly!)
Just a bit careful! :slight_smile:

The server has nothing to do with the database they are not really interested in each other, your server logs who,when,wher from errors etc but thats it.

Not sure what you mean about sending info(secretly)? do you mean malicious code? if anything dodgy gets as far as your SQL call you are in trouble anyway, putting it in a flatfile can do no harm. Make sure that any input is checked first using addslashes() etc (if magic_quotes_runtime is not already doing it for you.)

Thanks for the advice, but with the queries the scripts generate, I believe I could control.

Well, like people get information from your DB, then they don’t do anything harmful(deleting/changing stuff) or do anything that you could doubt someone is accessing. What they could do with the information is really unexpected!