How to do it...

  1. Shut down the MySQL server:
shell> sudo service mysqld stop
  1. Copy the files into the data directory (your directory may be different):
shell> sudo rsync -av /data/mysql /backupsor do rsync over ssh to remote servershell> rsync -e ssh -az /data/mysql/ backup_user@remote_server:/backups
  1. Start the MySQL server:
shell> sudo service mysqld start

Get MySQL 8 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.