Mysql – Percona restore databases error

backupMySQLreplication

I am trying to restore Percona backup but getting the below error.

[/]# xtrabackup --copy-back --target-dir=/backup-billingsystem
xtrabackup: recognized server arguments: --innodb_file_per_table=1 --open_files_limit=16384 --innodb_buffer_pool_size=128M --innodb_flush_log_at_trx_commit=2 --innodb_log_buffer_size=64M --innodb_io_capacity=100 --server-id=1 --log_bin=mysql-bin
xtrabackup: recognized client arguments: --password=* --user=root --copy-back=1 --target-dir=/backup-billingsystem
xtrabackup version 2.4.18 based on MySQL server 5.7.26 Linux (x86_64) (revision id: 29b4ca5)
Error: datadir must be specified.

Best Answer

The error message is quite explicit:

Error: datadir must be specified.

The documentation is clear on this too:

--datadir=DIRECTORY The source directory for the backup. This should be the same as the datadir for your MySQL server, so it should be read from my.cnf if that exists; otherwise you must specify it on the command line.

When combined with the --copy-back or --move-back option, --datadir refers to the destination directory.

Note the last sentence, and make sure you're providing the correct path.

The documentation is here.