I have Database I want to Encrypt located in var/lib/mysql. Is it possible to Encrypt the whole mysql directory? How would I go about doing this
1 Answers
Is it possible to encrypt the whole mysql directory?
No. eCryptFS (that would be the tool to use) encrypted directories are only accessible by the users that mount them. MySQL doesn't run as your user and can use more than 1 user to do its tasks so that creates a problem.
Is it possible to encrypt mysql? . How would I go about doing this
Create a partition, encrypt it using LUKS and then use that to mount 1 of the parts of the directory /var/lib/mysql/. It should be considered an advanced user task so make sure to make backups and know how to undo whatever you do to set this up. https://askubuntu.com/a/1335327/15811 explains how to use LUKS.
Mind that with an encrypted partition a reboot will never automatically start MySQL since you will need to manually unlock the partition when the system boots.
- 309,379