I want to store sensitive data in a MySQL database for a while, so I'd like to know a way to delete a MySQL database without having a chance of recovery. In Linux, we have a tool named shred which overwrites the content of the file repeatedly, so its content can never be recovered anymore. Problem is: I want to do it with a specific MySQL database. I know MySQL stores data in /var/lib/mysql, but there are several files there and it would destroy all databases and break MySQL. Any ideas?
Mysql – How to safe delete (shred) a MySQL database
MySQLSecurity
Best Answer
InnoDB leaves user data in several places.
ibdata1
ifinnodb_file_per_table=OFF
or respective *.ibd file ifinnodb_file_per_table=ON
. This is where InnoDB stores the data.ib_logfile0
andib_logfile1
stores recent modifications.ibdata1
no matter whatinnodb_file_per_table
is) stores recent modifications.To reliably delete user data you need to shred
ibdata1
- because of the double write buffer. If you do that, MySQL instance will be destroyed. So, I would say it's impossible to "shred" a particular database/table.In your case I would create a replica with
mysqldump
(ormydumper
, not with xtrabackup or a file system snapshot) and destroy the original instance/disk/server.