I am trying to create an encrypted MySQL backup on a remotes server using Java to prevent IT employees from viewing the backup. Basically the sever I'm working on runs MySQL, which generate .sql backup files that are easy to access. I searched a lot on how to create an encrypted backup with no effective result. What i came to at the end is to use the java server to compress the .sql file into a password protected rar file and delete the .sql file from the pc. Is there any better way to keep my backup non-accessible without the need of rar?
Asked
Active
Viewed 423 times
0
-
What `code` did you tried to encrypt the sql file? – Gunaseelan Dec 09 '15 at 11:35
-
@Gunaseelan I'm using a java service that calls a query to dump a backup `mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql` – Hassan Al Bourji Dec 09 '15 at 11:42
-
It is just going to create a mysql dump file for a database through mysql console. Where is the java code that you need to implement? – Gunaseelan Dec 09 '15 at 11:44
-
the java code not that deal it is just a service that is called every 2 hours to create this backup. I'm asking I can avoid using rar encryption with MySQL encryption. In SQL we can create a .bak file but we cant in MySQL – Hassan Al Bourji Dec 09 '15 at 11:49
-
Using java only, we can't able to create a password protected zip file. – Gunaseelan Dec 09 '15 at 11:52
-
@Gunaseelan this library allows you to do so http://www.7-zip.de/sdk.html – Hassan Al Bourji Dec 09 '15 at 11:56
1 Answers
0
I guess a password encrypted 7zip file would be better because it reduces the backup size. But since MySQL cannot encrypt by itself, you always have to do it externally.
If you code in Java, you can use the 7zip SDK for Java, which allows to encrypt also.

Daniel
- 27,718
- 20
- 89
- 133
-
that what i am doing so far but I'm just wondering if there is any other way because the data are extremely private and accurate and zip files can be brute forced easily if you have access to HPC. – Hassan Al Bourji Dec 09 '15 at 11:46
-
1I can't believe "Brute forced easily" in this context. If you are really afraid to have your stuff decrypted you could always double encrypt it with two different algorithms. Since knowing the contents of a backup will ease decryption, and since maybe all your backups start with similar headers you should always double encrypt them with different passwords. Else I believe HPC could really crack it. – Daniel Dec 09 '15 at 12:13