Magento 2 troubleshooting › Customers
How do I find and unlock locked Magento customer accounts?
Short answer: After too many failed logins, Magento locks the account until lock_expires. List those accounts with one query and unlock them from the customer page.
Check it step by step
These queries only read data. Run them on a copy of your database if you can, or ask your developer to. If your tables have a prefix (set in app/etc/env.php), add it to each table name.
Accounts locked right now
Works on Magento Open Source and Adobe Commerce:
SELECT entity_id, email, website_id, failures_num, first_failure, lock_expires
FROM customer_entity
WHERE lock_expires > NOW()
ORDER BY lock_expires DESC;
Accounts with recent failed logins
Works on Magento Open Source and Adobe Commerce:
SELECT entity_id, email, failures_num, first_failure
FROM customer_entity
WHERE failures_num > 0
ORDER BY failures_num DESC
LIMIT 50;
Many accounts with failures at the same time can mean a credential-stuffing attack, not forgetful customers.
How to fix it
- Unlock one account: open it in Customers › All Customers and click Unlock.
- The limits are in Stores › Configuration › Customers › Customer Configuration › Password Options: Maximum Login Failures to Lockout Account and Lockout Time (minutes).