Backup
mysqldump -u root -p database1 > database.sql
tar -zcvf data.tar.gz data
Restore
CREATE DATABASE database1;
CREATE USER ‘user’@’localhost’ IDENTIFIED BY ‘pwd’;
GRANT ALL PRIVILEGES ON database1 . * TO ‘user’@’localhost’;
FLUSH PRIVILEGES;
mysql -u root -p database1 < database.sql
tar -zxvf
data
.tar.gz
new website:
curl https://wordpress.org/latest.tar.gz | sudo -u www-data tar zx -C /srv/www
update wp-config.php with the new password
sudo chown -R www-data:www-data /var/www/data
find /var/www/data -type d -exec chmod 755 {} \;
find /var/www/data -type f -exec chmod 644 {} \;