1

I need to find all the users when they last logged in in mysql. My goal is to cleanup users that are not used for months. Please help

3
  • Mysql version 5.7.25. When i ran the SELECT plugin from mysql.user , I got 'mysql_native_password'
    – Surya
    Commented Mar 15, 2020 at 19:17
  • Also i am looking for all the users including application users.
    – Surya
    Commented Mar 15, 2020 at 19:19
  • What kind of application is this?
    – Rick James
    Commented Mar 29, 2020 at 2:39

1 Answer 1

0

mysql hasn't such a thing. You could force the users to change the password every 90 days and select the date, where the users didn't change their password.

By

SELECT User FROM mysql.user WHERE password_last_changed <  NOW() - INTERVAL  3 MONTH;

Everything else would require things like enable file logs see for more information

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.