1) Add following startup parameters to my.cnf on source server under [mysqlbackup].
user = mysql_backup_user
password
socket=/var/lib/mysql/mysql.sock
2) Take full backup as image file.
3) Copy the backup folder to target server. (make sure the destination directyory has right permissions)
4) Stop the mysql service on destination.
5) Remove all the files in mysql data directory.
6) Grant owner permissions to the account used to access the backup image file location.
7) Use following command to restore full by applying the logs.
8) Bring the service online. (Initially it failed to bring the service online, fixes are provided below)
i) Can't change dir to '/var/lib/mysql/' (Errcode: 13 - Permission denied)
Fix: #chown -R mysql:mysql /var/lib/mysql (add permissiona to mysql user)
ii) SELinux is preventing /usr/sbin/mysqld from getattr access on the file /var/lib/mysql/ibdata1.
Fix: #restorecon -R -v /var/lib
9) Now you should be able to successfully bring the services online.
user = mysql_backup_user
password
socket=/var/lib/mysql/mysql.sock
2) Take full backup as image file.
#mysqlbackup --backup-dir=/usr/siva/mysql_full_backup --backup-image=full.bki backup-to-image
3) Copy the backup folder to target server. (make sure the destination directyory has right permissions)
#scp -r /usr/siva/mysql_full_backup/ siva@192.168.159.143:/usr/siva/
4) Stop the mysql service on destination.
systemctl stop mysqld
5) Remove all the files in mysql data directory.
#rm -rf /var/lib/mysql/
6) Grant owner permissions to the account used to access the backup image file location.
#chown -R siva:siva /usr/siva/
7) Use following command to restore full by applying the logs.
#mysqlbackup --datadir=/var/lib/mysql --backup-image=/usr/siva/mysql_full_backup/full.bki --backup-dir=/usr/siva/mysql_full_backup copy-back-and-apply-log
8) Bring the service online. (Initially it failed to bring the service online, fixes are provided below)
#systemctl start mysqldIssues encountered while bringing the service online.
i) Can't change dir to '/var/lib/mysql/' (Errcode: 13 - Permission denied)
Fix: #chown -R mysql:mysql /var/lib/mysql (add permissiona to mysql user)
ii) SELinux is preventing /usr/sbin/mysqld from getattr access on the file /var/lib/mysql/ibdata1.
Fix: #restorecon -R -v /var/lib
9) Now you should be able to successfully bring the services online.