A bot has recently created more than 6000 accounts, and they all have an e-mail adres @qq.com .
what is the best way to remove these accounts in phpMyadmin ?
Solved! Go to Solution.
Above solution not work practically because it would delete from "customer_entity" table only., what if have records into child tables. Use below code to delete customers.
$customers = Mage::getModel("customer/customer") ->getCollection() ->addAttributeToFilter('email', array('like' => '%@qq.com')); foreach ($customers as $customer) { $customer->delete(); } exit("customers deleted");
Good luck
Hi,
Please have a backup of your DB before executing the following commands.
Execute this sql query directly on your database
If you use table name prefixes please change the table names accordingly
DELETE FROM `customer_entity` WHERE email ='a@b.com';
Above solution not work practically because it would delete from "customer_entity" table only., what if have records into child tables. Use below code to delete customers.
$customers = Mage::getModel("customer/customer") ->getCollection() ->addAttributeToFilter('email', array('like' => '%@qq.com')); foreach ($customers as $customer) { $customer->delete(); } exit("customers deleted");
Good luck
The cascading deletes on the DB should take care of entries in the child tables (customer address etc) therefore the sql given in the original answer is the better one to use and a lot less resource hungry.
Witch answer do you prefer ?
The answer from GMehta or Magikvishal