Xtrabackup --target-dir No such file or directory

Hi There, when taking a backup I am getting an error that indicates the --target-dir doesnt exist “No such file or directory”, however, when I look in the location, I can see xtrabackup_backupfiles is being created and it has the contents of my /var/lib/mysql, why would this happen??

Thx

Please show us some output including commands used and result.

Hi @matthewb

Here is the command:

xtrabackup -H localhost -P 3306 --backup -u root -p; --target-dir=/usr/local/backup/PerconaDB

I am prompted for the password and then the console shows me that the backup is taken and ends with:

2024-05-07T16:07:46.710406+01:00 0 [Note] [MY-011825] [Xtrabackup] Transaction log of lsn (63597358) to (63597378) was copied.
2024-05-07T16:07:46.930615+01:00 0 [Note] [MY-011825] [Xtrabackup] completed OK!
-bash: --target-dir=/usr/local/backup/PerconaDB: No such file or directory

Here is the console output of the backup folder

[root@rhel-8 xtrabackup_backupfiles]# pwd
/usr/local/backup/PerconaDB/xtrabackup_backupfiles
[root@rhel-8 xtrabackup_backupfiles]# ls
binlog.000004  ib_buffer_pool  mysql      performance_schema  undo_001  xtrabackup_binlog_info  xtrabackup_info     xtrabackup_tablespaces
backup-my.cnf  binlog.index   ibdata1         mysql.ibd  sys                 undo_002  xtrabackup_checkpoints  xtrabackup_logfile

This is why. Is your password semi-colon? This ; character is telling bash (your shell) that what comes after is a different command. Effectively you have two commands:

#1 xtrabackup -H localhost -P 3306 --backup -u root -p

#2 --target-dir=/usr/local/backup/PerconaDB

Remove that random ; and try again.