Encrypting MySQLDump

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

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

  1. Create a  encryption key file as /root/.backup_keyfile and add the password/key in  that file
  2. This keyfile  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 :

      mysqldump --opt  opsview |  ccrypt  -k /root/.encryptkeyfile > opsview.sql

Capture

This will encrypt the opsview.sql file and to  decrypt the opsview.sql file use :

[[email protected] ~]# cat opsview.sql | ccrypt -d -k /root/.backup_keyfile > opsview1.sql

Capture

This will  decrypt the opsview.sql file, easy  isn’t it 😀