It's useful to have an instant encryption on the fly. Database backup would be one of the most important tasks carried out for daily operation. Encryption helps backup operator to secure the backup which can then be copied to anywhere for storage, without too much concern over the data privacy.
To backup mysql database with further encryption, we can type the following command:
Note: -P parameter would point to a key file which contains the password for encryption purposes. Of course, you'll need that when you want to decrypt the file again.
To retrieve the original backup file from the encrypted copy, we can type this: