Hi,

Can anyone please tell me how to log all activity of my mysql database.
Also do you know if there any tripwire services/products that are available ?

Thanks,

Dani AI

Generated

Brief summary and immediate fix based on the config snippet and process output posted by : the server is only writing the error log because the general-query/slow‑query options are not in the server section. was correct that you want the general query log to capture all statements, but those directives must be applied to the server (mysqld) and not the client or the safety wrapper. Enable logging temporarily from SQL to verify behavior, then add persistent directives under the server section and restart.

Quick steps to reproduce and verify (run as a DBA user):

SHOW VARIABLES LIKE 'general_log%';
SET GLOBAL general_log_file = '/var/log/mysql/general.log';
SET GLOBAL general_log = 'ON';
-- when finished:
SET GLOBAL general_log = 'OFF';

Troubleshooting checklist if nothing appears after enabling:

  • Confirm which my.cnf is actually being read and move logging options into the server ([mysqld]) section.
  • Ensure the directory/file exists and is writable by the mysql user; check filesystem permissions and SELinux/AppArmor rules.
  • Inspect the error log for startup warnings about failing to open a log file.
  • If mysqld is launched with a command-line --log-error option, that will direct errors there regardless of other settings; check your init/systemd unit or startup wrapper for extra options.
  • Use logrotate or similar — general and audit logs grow fast on busy servers.

Notes on production and alternatives:

  • The general query log is very verbose and can impact performance; use it only for short investigations.
  • For long-term auditing, prefer an audit plugin (MySQL Enterprise Audit, Percona/MariaDB audit plugins) or a dedicated auditing solution.
  • For filesystem/config integrity (the “tripwire” use case) consider host-based tools such as Tripwire, AIDE or OSSEC in addition to DB-level auditing.

Recommended Answers

All 2 Replies

Set up a general query log. Cf. http://dev.mysql.com/doc/refman/5.0/en/server-logs.html

Locate your configuration file. It's usually called my.cnf and in /etc/mysql.
Locate a log-bin entry in my.cnf or add it, if it's not there. log-bin = <location of logfile> Restart the mysql server process.

Thanks. I add this and some different combinations but I am still only logging errors :

[root@william etc]# cat  /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0
[mysql]
log=/var/log/mysql.log

[mysqld_safe]
long_query_time  = 1
log-queries-not-using-indexes
root      2424  0.0  0.2  63904  1188 pts/2    S    14:44   0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --user=mysql

Can anyone assist ?

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.