# Xtrabackup --target-dir No such file or directory

**URL:** <https://forums.percona.com/t/xtrabackup-target-dir-no-such-file-or-directory/30027>\
**Category:** Percona XtraDB Cluster 8.x\
**Created:** [May 3, 2024, 3:40pm UTC](https://forums.percona.com/t/xtrabackup-target-dir-no-such-file-or-directory/30027 "2024-05-03T15:40:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikejohnhathaway](https://avatars.discourse-cdn.com/v4/letter/m/d9b06d/32.png) [@mikejohnhathaway](https://forums.percona.com/u/mikejohnhathaway)\
**Post date:** [May 3, 2024, 3:40pm UTC](https://forums.percona.com/t/xtrabackup-target-dir-no-such-file-or-directory/30027/1 "2024-05-03T15:40:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [May 4, 2024, 7:37pm UTC](https://forums.percona.com/t/xtrabackup-target-dir-no-such-file-or-directory/30027/2 "2024-05-04T19:37:18Z")

</div>

Please show us some output including commands used and result.

---

<div class="post-metadata">

**Author:** ![mikejohnhathaway](https://avatars.discourse-cdn.com/v4/letter/m/d9b06d/32.png) [@mikejohnhathaway](https://forums.percona.com/u/mikejohnhathaway)\
**Post date:** [May 7, 2024, 3:10pm UTC](https://forums.percona.com/t/xtrabackup-target-dir-no-such-file-or-directory/30027/3 "2024-05-07T15:10:46Z")

</div>

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:

```auto
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

```auto
[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

```

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [May 7, 2024, 5:43pm UTC](https://forums.percona.com/t/xtrabackup-target-dir-no-such-file-or-directory/30027/4 "2024-05-07T17:43:36Z")

</div>

> [@mikejohnhathaway](#):
>
> -p;

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.
