Suppose I have one table called 'privacy':
privacy (id INT PRIMARY KEY, data BINARY(512))
Suppose I insert one row in such table:
INSERT INTO privacy(1, 'CIPHERTEXT')
with CIPHERTEXT the pseudo random bytes result of an AES encryption of certain plaintext.
My concern comes when UPDATING the data
column or DELETING such row: Indeed, for privacy reasons, I don't want that someone who access my server retreive erased data
values.
Does MySQL really delete the previous data from the hard drive when UPDATE/DELETE commands are sent ? Must we UPDATE the row with random data before DELETE command execution ?
Note: my server use an SSD hard drive with TRIM enabled and tables engines are InnoDB.
Thanks.
When InnoDB updates a record there are two paths possible:
When InnoDB deletes a record, it's not deleted actually - the record is marked as free. The deleted record may stay in a page for a while until B+ tree is rebalanced (read - a lot of records are inserted or deleted).
Having said that your old record is recoverable with high chance of success no matter what you do.