# Percona xtrabackup binlog Permission denied

**URL:** <https://forums.percona.com/t/percona-xtrabackup-binlog-permission-denied/24108>\
**Category:** Percona XtraBackup\
**Tags:** percona\
**Created:** [August 1, 2023, 3:55pm UTC](https://forums.percona.com/t/percona-xtrabackup-binlog-permission-denied/24108 "2023-08-01T15:55:02Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Isreal\_Urephu](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/isreal_urephu/32/12015_2.png) [@Isreal\_Urephu](https://forums.percona.com/u/Isreal_Urephu)\
**Post date:** [August 1, 2023, 3:55pm UTC](https://forums.percona.com/t/percona-xtrabackup-binlog-permission-denied/24108/1 "2023-08-01T15:55:02Z")

</div>

![image](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/4/4333f07164942c340650c6e1cf138d98af7abf29.png)  
when i run percona backup it generates a new binlog file each time , but it doesnt get the permissions auto applied so it wont back it up and then it throws me an error. How can i resolve this please?

---

<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:** [August 1, 2023, 6:49pm UTC](https://forums.percona.com/t/percona-xtrabackup-binlog-permission-denied/24108/2 "2023-08-01T18:49:41Z")

</div>

Hello @Isreal_Urephu,  
When executing `FLUSH BINARY LOGS`, MySQL handles the rotation by closing the old binlog and creating a new one. Can you please manually check the permissions, ownership of binlog.000109?

```
$ ls -la /var/lib/mysql/binlog.000189

```

Please also confirm that MySQL is running as the `mysql` OS user and that you are running PXB using `root` or `mysql` OS user.

---

<div class="post-metadata">

**Author:** ![Isreal\_Urephu](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/isreal_urephu/32/12015_2.png) [@Isreal\_Urephu](https://forums.percona.com/u/Isreal_Urephu)\
**Post date:** [August 2, 2023, 9:08am UTC](https://forums.percona.com/t/percona-xtrabackup-binlog-permission-denied/24108/4 "2023-08-02T09:08:37Z")

</div>

![image](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/4/4b5c134a7c5d8419074fd31cdea6e85b31fb37be.png)

That is the current permission of the bin logs. When the percona xtrabackup is run it generate another bin log file with permission of 640 and then throw me that error. The rest binlongs above binlog.000190 have their permission set to 777 because I did it manually but the new binlog generated doesnt get the permissions auto applied so it wont back it up.

---

<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:** [August 2, 2023, 2:50pm UTC](https://forums.percona.com/t/percona-xtrabackup-binlog-permission-denied/24108/5 "2023-08-02T14:50:06Z")

</div>

You didn’t indicate how you are running PXB. What OS user executes PXB? Have you modified the permissions of any of the tablespaces or other directories within /var/lib/mysql ?

---

<div class="post-metadata">

**Author:** ![Isreal\_Urephu](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/isreal_urephu/32/12015_2.png) [@Isreal\_Urephu](https://forums.percona.com/u/Isreal_Urephu)\
**Post date:** [August 2, 2023, 3:14pm UTC](https://forums.percona.com/t/percona-xtrabackup-binlog-permission-denied/24108/6 "2023-08-02T15:14:32Z")

</div>

Below is the code I executed to run the backup

```auto
docker create --name backup-nolock --volumes-from mysql -v /backup:/backup --network=darkiq_old_default percona/percona-xtrabackup:8.0.33-28 xtrabackup --backup --no-lock --datadir=/var/lib/mysql/ --target-dir=/backup --user=root --password=9l ****** 8 --host=172.18.0.2

```

I am executing PXB as a root user. I modified the /var/lib/mysql to 777 inside mysql container.

---

<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:** [August 2, 2023, 5:47pm UTC](https://forums.percona.com/t/percona-xtrabackup-binlog-permission-denied/24108/7 "2023-08-02T17:47:16Z")

</div>

Since you’re doing docker-to-docker style backups, I’d check all the file permissions, user mappings between containers, etc. You should not have to 777 anything.

---

<div class="post-metadata">

**Author:** ![Isreal\_Urephu](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/isreal_urephu/32/12015_2.png) [@Isreal\_Urephu](https://forums.percona.com/u/Isreal_Urephu)\
**Post date:** [August 3, 2023, 3:41pm UTC](https://forums.percona.com/t/percona-xtrabackup-binlog-permission-denied/24108/8 "2023-08-03T15:41:08Z")

</div>

I am getting more confused. The issue is that whenever i run the percona backup with the above command, it automatically generates a new binlog file which will not back up and throw me a permission denied error as shown on the screenshot i sent. I am using MYSQL user to run the backup.

---

<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:** [August 3, 2023, 3:52pm UTC](https://forums.percona.com/t/percona-xtrabackup-binlog-permission-denied/24108/9 "2023-08-03T15:52:49Z")

</div>

> [@Isreal\_Urephu](#):
>
> whenever i run the percona backup with the above command, it automatically generates a new binlog file

Yes, I understand exactly what you are saying. However, you need to understand that PXB **is not** creating the new binlog. PXB itself does **not** create binary logs. _MySQL_ is creating the new binlog. Whatever permissions `mysqld` is running as is the permissions (owner) that the new binlog file will inherit.

`chmod 777` is incorrect and a bad practice.

I see someone else had a similar issue with PXB and docker. Please [look over this conversation](https://forums.percona.com/t/xtrabackup-in-docker-from-percona-percona-xtrabackup-8-0-for-mysql-8-33-on-docker-fails-with-error-my-012592-innodb-operating-system-error-number-13-in-a-file-operation/23017/4) and see if you have a similar setup.
