# audit - does mysql store when users last accessed / logged into the database?

**URL:** <https://forums.percona.com/t/audit-does-mysql-store-when-users-last-accessed-logged-into-the-database/6656>\
**Category:** Other MySQL® Questions\
**Created:** [October 29, 2018, 6:12pm UTC](https://forums.percona.com/t/audit-does-mysql-store-when-users-last-accessed-logged-into-the-database/6656 "2018-10-29T18:12:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mysql.girl](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/mysql.girl/32/29_2.png) [@mysql.girl](https://forums.percona.com/u/mysql.girl)\
**Post date:** [October 29, 2018, 6:12pm UTC](https://forums.percona.com/t/audit-does-mysql-store-when-users-last-accessed-logged-into-the-database/6656/1 "2018-10-29T18:12:37Z")

</div>

I am looking for a way to track when users login and exit the database?  
is there such function built in to track and trace this ?  
I don’t see any timestamp in mysql.user table and information\_schema statistics table is empty

---

<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:** [October 30, 2018, 2:05am UTC](https://forums.percona.com/t/audit-does-mysql-store-when-users-last-accessed-logged-into-the-database/6656/2 "2018-10-30T02:05:32Z")

</div>

Hi thanks for your question. Here’s a blog post that covers that topic (though not with positive news): [URL=“[Auditing login attempts in MySQL](https://www.percona.com/blog/2012/12/28/auditing-login-attempts-in-mysql/)”][https://www.percona.com/blog/2012/12...mpts-in-mysql/[/URL]](https://www.percona.com/blog/2012/12...mpts-in-mysql/%5B/URL%5D) - information\_schema gets cleared down after a mysqld restart.

An alternative might be Percona’s audit log plugin [URL=“[Audit Log Plugin — Percona Server 8.0 Documentation](https://www.percona.com/doc/percona-server/LATEST/management/audit_log_plugin.html)”][https://www.percona.com/doc/percona-...og\_plugin.html[/URL]](https://www.percona.com/doc/percona-...og_plugin.html%5B/URL%5D) or the MySQL Enterprise equivalent. This writes login and logout to log files.

Would that work for you?
