Percona xtrabackup binlog Permission denied


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?

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.

image

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.

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 ?

Below is the code I executed to run the backup

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.

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.

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.

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 and see if you have a similar setup.