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
Asked
Active
Viewed 6,079 times
1
-
Mysql version 5.7.25. When i ran the SELECT plugin from mysql.user , I got 'mysql_native_password' – Surya Mar 15 '20 at 19:17
-
Also i am looking for all the users including application users. – Surya Mar 15 '20 at 19:19
-
What kind of application is this? – Rick James Mar 29 '20 at 02:39
1 Answers
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
nbk
- 8,191
- 5
- 13
- 27