How to restore data form Machine A to Machine B

Hi,everyone I have a question when I worked on my project.

I backup my database and create the folder by name like “20201021” on Machine A,

and I copy this folder to Machine B then start restore by “20201021”.it works!

but when I "service mysqld start " mysql can’t start.

I already chown -R mysql: /var/lib/mysql.

my step:

xtrabackup --backup …=>create folder “20201021” on

  • Machine A
  • switch to Machine B and Copy "20201021" to this Machine
  • service mysqld stop

xtrabackup --user=root --password=123–prepare --target-dir= /

  • 20201021
  • Complete OK

xtrabackup --prepare --apply-log-only --target-dir=/

  • 20201021
  • Complete OK

Clear /var/lib/mysql on

  • Machine B

xtrabackup --user=root --password=root --copy-back --target-dir=/

  • 20201021
  • Complete OK
  • chown -R mysql: /var/lib/mysql
  • service mysqld start
  • Service Start Failed
  • This is mysqld log

Hello,

If the file binlog.index exists, try to run (group permissions are also important sometimes) chown -R mysql:mysql /var/lib/mysql

Or provide the full output of your error log (cat /var/log/mysql/error.log by default).