How to show user login times for WordPress site without plugin using MySQL
There are many plugins available that will give you the last login time for users, but what if you just want to run a quick script to see user activity on your site?
If you have access to the cPanel of your website, you may also have access to the phpMyAdmin, open up a SQL Editor tab.
Paste this into the SQL Editor and click Go
SELECT user_id, wp_users.user_login,
FROM_UNIXTIME(substring_index(substring_index(meta_value, ‘”login”;i:’, -1), ‘;}}’, 1)) as last_login
FROM wp_usermeta
inner join wp_users on user_id = wp_users.ID
WHERE meta_key=’session_tokens’
You may need to change the table names from wp_ to wpXXX_ where XXX is the secure part of your database schema.
I hope this helps!