I want to store the email addresses of users in a MySQL database using encryption to ensure that they won\'t be made public if the database gets compromised. I believe if I encr
When a user registers on your site, use AES_ENCRYPT() to encrypt the email.
INSERT into users (email) VALUES (AES_ENCRYPT('someemail@example.com', 'aeskey'));
When you query your database, you can call the AES_DECRYPT() function like this:
SELECT AES_DECRYPT(email, 'aeskey') from users;