How to anonymize IP addresses from database

Hi

I have Piwik database containing over 20M visits. I need to anonymize those IP addresses. Anonymize setting on Piwik doesn’t anonymize existing IP addresses from database. Do you have some script example how to do this?

…Well here is solution in case somebody else need this:


UPDATE piwik.piwik_log_visit 
SET location_ip = INET6_ATON(INET_NTOA(conv(hex(location_ip), 16, 10) & INET_ATON('255.255.0.0')));