gymcode
gymcode

Reputation: 4623

Enable MySQL syslog to log aborted connections and access-denied

What is the command in mysql that is required to that I can implement aborted connections and access-denied logs to be written to the syslog?

Upvotes: 0

Views: 1142

Answers (1)

Drew
Drew

Reputation: 24959

The commands are first to see what your settings are:

select @@general_log; -- a 1 indicates it is turned on for capture
select @@general_log_file; -- the file that it logs to
select @@datadir; -- directory location where the log lives

To turn logging on for the General Query Log, use the following:

SET GLOBAL general_log = 'ON'; -- 0 is off, 1 is on

Note that the datadir is read-only and requires a restart of the server after changes. Basically, don't change this. It is the home of your database schemas.

For expanded connection failures perform a

select @@log_warnings; -- make a note of your prior setting
set global log_warnings=2; -- setting above 1 increases output

The immediate above relates to the Error log written out in the same datadir.

See the Percona article Auditing login attempts in MySQL and my prior answer Here.

Upvotes: 3

Related Questions