Anonymous
×
Create a new article
Write your page title here:
We currently have 27 articles on PhenixOps. Type your article name above or click on one of the titles below and start writing!



PhenixOps
27Articles

Backup and Restore: Difference between revisions

 
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