How to Encrypt MySQLDump

If you are looking to Encrypt your MySQL database dump for security reasons then you can use the crypt tool to encrypt your dump.sql file.

Follow the below simple steps to  achieve the database dump encryption and decryption :

  1. Create an encryption key file as /root/.backup_keyfile and add the password/key in  that file
  2. This key file  will be used to  encrypt and decrypt the data [dump.sql file]

Now,  that we have created the encryption  file we just need to  execute the below commands :

[code]  mysqldump –opt  opsview |  ccrypt  -k /root/.encryptkeyfile > opsview.sql[/code]

This will encrypt the opsview.sql file

To  decrypt the opsview.sql file use :

[code]cat opsview.sql | ccrypt -d -k /root/.backup_keyfile > opsview1.sql[/code]

This will  decrypt the opsview.sql