Good afternoon!

I am wondering if there is a way to log queries that have occured on a database or specific table? For example, is it possible to log the user, the query type (insert, update, delete, select, execute etc...), date, time, table, row and column(s) affected by the queries (if applicable) so that someone can in effect, "audit" our system?

This isn't a web database, it's a local sql server on our intranet.

Any suggestions or ideas would be greatly appreciated!

to enable the query log, put this in /etc/my.cnf in the [mysqld] section

log   = /path/to/query.log

remember that this logfile can grow very big on a busy server

update:

as of mysql 5.1.12 you should use

general_log=1

with mysql 5.1.29, the log option is deprecated. to specify the logfile use

general_log_file=/path/to/query.log
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.