New user Having a problem configuring xtrabackup on the command line - restore fails and after I cannot restart my mysql server.
Can you please advise whether my scripts is ok . My backup Directory is /Database/ (backup appears here as mysql
my restore script stops the server and removes the contents of var/lib/mysql so left with empty mysql directory
This is my script- #stop the mysql server
sudo service mysql stop
#remove the old mysql directory contents
rm -rf /var/lib/mysql/*
#restore the mysql directory
xtrabackup --datadir=/var/lib/mysql/ --login-path=local --restore --target-dir=$BACKUP_DIR/mysql/
#Set new mysql directory ownership
chown -R mysql:mysql /var/lib/mysql
#restart the mysql server
sudo service mysql start
You need to check the log from xtrabackup to find out if the problem is the backup itself or the script.
For reference you can check the full backup cycle here: The Backup Cycle - Full Backups - Percona XtraBackup