0

I need to permanently purge single records from a MySql database (Mssql would be interesting too). By purge I mean unrecoverably send it into oblivion.

I need this either for compliance with EU-GDPR and also for a client who wants to make sure that data is removed from MySQL for good.

As I understand

delete from table where id=1

would remove the data from the table-space and from the indexes but not from the transaction log. To achieve this one needs to perform a shrink. But even than the record would still be existing binary on disk.

What I need to achieve it to really and truly destroy that database record so that even Hacker-Jesus could not recover it.

I already spent some thoughts on that and a first idea was to not delete the record but overwrite the data in the columns with random data. As I understand the Mysql documentation that would overwrite the physical memory of the old data. So if there was a column secret_column with the data secret info I would overwrite is with 'XXXXXXXXXXX' shrink the database and the old value of the column should be gone. Another more secure option would be the synchronously encrypt the secret_column and store the key in another column cypherkey. Then when I want to delete the record I decrypt the column, create a temporary in-memory key, encrypt the data with the temp key and write it back to the database. That should destroy the information for good - but this is impossible to use with indexed columns in respect to performance.

I am well aware of the fact, that any backup of the database would still contain the purged data. That is another miracle to solve.

I would appreciate any ideas or (better) solutions to that question. Thank's a lot.

squillman
  • 13,363
  • 3
  • 41
  • 60
LordObi
  • 114
  • 5
  • I removed the sql-server tag. SQL Server <> MySQL. – squillman Jul 03 '18 at 19:04
  • To the best of my knowledge, this is not possible. Even if you delete this record, the ID would (**and should**) remain indefinitely. The idea here being that the record with id existed once, but no longer exists. You **should not** be trying to reuse primary keys that have been deleted. It is a bad idea from a technical standpoint. One possible option would be to copy data that you needed and remove the table permanently. – ccarpenter32 Jul 03 '18 at 19:11
  • Make sure you wipe the drives and burn them afterwards. – Salman A Jul 03 '18 at 20:58

0 Answers0