I’ve been using the mysql console tip for years from this blog post by Brian Resig (maintaining a few legacy sites), and struggled to find it this time. In fear of losing it entirely, I’m copying it here. I’ll thank myself one day I’m sure!
mysql -u admin -p`cat /etc/psa/.psa.shadow` psa -e “SELECT accounts.id, mail.mail_name, accounts.password, domains.name FROM domains LEFT JOIN mail ON domains.id = mail.dom_id LEFT JOIN accounts ON mail.account_id = accounts.id where mail_name=’ENTER MAIL NAME HERE’ “