# How to enable logging of failed accesses on MySQL 8.0

**URL:** <https://forums.percona.com/t/how-to-enable-logging-of-failed-accesses-on-mysql-8-0/7461>\
**Category:** Percona Server for MySQL\
**Created:** [March 10, 2020, 12:50pm UTC](https://forums.percona.com/t/how-to-enable-logging-of-failed-accesses-on-mysql-8-0/7461 "2020-03-10T12:50:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ultratronix](https://avatars.discourse-cdn.com/v4/letter/u/9de053/32.png) [@ultratronix](https://forums.percona.com/u/ultratronix)\
**Post date:** [March 10, 2020, 12:50pm UTC](https://forums.percona.com/t/how-to-enable-logging-of-failed-accesses-on-mysql-8-0/7461/1 "2020-03-10T12:50:57Z")

</div>

Hi everyone,  
just installed my first MySQL 8.0 version. I need to log all failed access to mysql. I added “log-error-verbosity = 3” on my “mysqld.cnf” file of my Debian 10 distribution and restarted the server. Then I tried to emulate a failed login, but this event is not saved by any log file (in particular, the /var/log/mysql/error.log remains empty).

How can I enable failed log attempts on MySQL 8.0 so that I can use it in conjunction with fail2ban?

---

<div class="post-metadata">

**Author:** ![lorraine.pocklington](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/lorraine.pocklington/32/37_2.png) [@lorraine.pocklington](https://forums.percona.com/u/lorraine.pocklington)\
**Post date:** [March 11, 2020, 4:51am UTC](https://forums.percona.com/t/how-to-enable-logging-of-failed-accesses-on-mysql-8-0/7461/2 "2020-03-11T04:51:28Z")

</div>

Hi ultratonix thanks for asking. Can I just check with you if you’re using Percona Server for MySQL 8.0 or MySQL Community edition? I’m just wondering if the audit log plugin might help here? [URL][https://www.percona.com/doc/percona-server/LATEST/management/audit\_log\_plugin.html[/URL]](https://www.percona.com/doc/percona-server/LATEST/management/audit_log_plugin.html%5B/URL%5D)

---

<div class="post-metadata">

**Author:** ![ultratronix](https://avatars.discourse-cdn.com/v4/letter/u/9de053/32.png) [@ultratronix](https://forums.percona.com/u/ultratronix)\
**Post date:** [March 11, 2020, 12:03pm UTC](https://forums.percona.com/t/how-to-enable-logging-of-failed-accesses-on-mysql-8-0/7461/3 "2020-03-11T12:03:10Z")

</div>

Hi, thank you for your reply.  
I’m using MySQL Community edition. At the moment, no failed login attempts on any of the log files…

---

<div class="post-metadata">

**Author:** ![jrivera](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/jrivera/32/13_2.png) [@jrivera](https://forums.percona.com/u/jrivera)\
**Post date:** [March 29, 2020, 7:17am UTC](https://forums.percona.com/t/how-to-enable-logging-of-failed-accesses-on-mysql-8-0/7461/4 "2020-03-29T07:17:42Z")

</div>

You can use the Percona audit log plugin on MySQL Community edition. Just download the equivalent version of Percona Server from our downloads site, extract the audit\_log.so file and put it in the plugin directory. Install the audit\_log plugin and then test.

Here’s a sample of a failed login using wrong password:

\<AUDIT\_RECORD

NAME=“Connect”

RECORD=“12\_2020-03-29T12:38:54”

TIMESTAMP=“2020-03-29T12:44:32Z”

CONNECTION\_ID=“12”

STATUS=“1045”

USER=“root”

PRIV\_USER=“root”

OS\_LOGIN=“”

PROXY\_USER=“”

HOST=“localhost”

IP=“”

DB=“”

/\>

```auto

```

---

<div class="post-metadata">

**Author:** ![GergoGalamb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/gergogalamb/32/22780_2.png) [@GergoGalamb](https://forums.percona.com/u/GergoGalamb)\
**Post date:** [April 23, 2021, 3:17pm UTC](https://forums.percona.com/t/how-to-enable-logging-of-failed-accesses-on-mysql-8-0/7461/5 "2021-04-23T15:17:50Z")

</div>

I use audit\_log\_plugin on MySQL 8.0.24 and the plugin is working, but the record time is not valid:

audit\_record":{“name”:“Query”,“record”:“544629\_1970-01-01T00:00:00”," **timestamp":"2021-04-23T13:37:25Z**",

SETUP:  
audit\_log\_format = JSON  
audit\_log\_policy = ALL  
audit\_log\_handler = SYSLOG  
audit\_log\_strategy = SYNCHRONOUS  
audit\_log\_syslog\_facility = LOG\_USER  
audit\_log\_syslog\_ident = MySQL-Audit-Log  
audit\_log\_syslog\_priority = LOG\_INFO

Do you know what is the issue?

---

<div class="post-metadata">

**Author:** ![Leonardo\_Figueroa](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/leonardo_figueroa/32/8187_2.png) [@Leonardo\_Figueroa](https://forums.percona.com/u/Leonardo_Figueroa)\
**Post date:** [April 13, 2023, 11:45pm UTC](https://forums.percona.com/t/how-to-enable-logging-of-failed-accesses-on-mysql-8-0/7461/6 "2023-04-13T23:45:08Z")

</div>

Hello @GergoGalamb  
What do you mean by the record time is not valid?  
The time is in UTC, that’s what the “Z” means at the end of the time
