1. delete all your posts the same way they would be deleted if you went to them and pressed the delete button.
2. Anonymize them (replace user name with "deleted user <randomnumber>").
3. Keep storing the username
After that, delete all other data (profile, settings, e-mail, password hash, ...)