How can I see the last queries for a MySQL DB?
I am a DB administrator. For example, when an application queries the DB, how they can be viewed?
|
feedback
|
This question came from our site for professional and enthusiast programmers.
|
On a development database, you can enable the query log: mysqld_safe --log & This will create a log in the data directory with your machine's hostname. If you then do something like tail -f on the log (at least in the Unix world, not sure about Windows), you'll be able to see the queries as they are happening. I said "development," because I don't think there is a way to do this in the production system that won't cause production to come to a halt. | |||
feedback
|
|
You can enable the query log as mentioned. If you want to log particular messages on a system under development you could run the development system through the mysql proxy. Basically it is a service that can sit between the mysql server and client(s). There are many code samples about how to log or manipulate data based on criteria you set. | |||
|
feedback
|