There’s a good reason why that feature is disabled by default. You should have a really good reason to enable it and you should trust them to not abuse that feature. Maybe use a higher anonymous_posting_min_trust_level
?
You can use the following query in the Data Explorer if you really need to find out who’s who. But, if you need to use it on a regular basis you should really ask yourself if your community members are ready for the anonymous posting feature.
Choose the right query depending on your version of Discourse:
Query for Discourse v2.3 and newer
SELECT a.username AS anonymous_username, u.username AS original_username
FROM users u
JOIN anonymous_users au ON (u.id = au.master_user_id)
JOIN users a ON (a.id = au.user_id)
Query for Discourse v2.2 and below
SELECT a.username AS anonymous_username, u.username AS original_username
FROM users u
JOIN user_custom_fields ucf ON (u.id = ucf.user_id)
JOIN users a ON (a.id = ucf.value::INT)
WHERE ucf.name = 'shadow_id'
ORDER BY a.username