No edit summary |
|||
Line 23: | Line 23: | ||
mysql -u root -p databasename < /path/to/mysql/database.sql | mysql -u root -p databasename < /path/to/mysql/database.sql | ||
</code> | </code> | ||
[[Category:MySql]] |
Latest revision as of 23:28, 18 April 2020
Backup MySql databases and encrypt them
Make a backup
mysqldump -u root -p databasename > /path/to/mysql/database.sql
Encrypt (This will ask for a password when invoked)
openssl enc -aes-256-cbc -in /path/to/mysql/database.sql -out /backups/enc-database.sql
Decrypt (Provide the password you used to encrypt
openssl enc -aes-256-cbc -d -in /backups/enc-database.sql > /path/to/mysql/database.sql
Restore the backup
mysql -u root -p databasename < /path/to/mysql/database.sql