XtraBackup getting failed while --databases-file run with error: Cannot open ……

I am running a shell script for taking backup of the database using Percona’s XtraBackup tool,want to filtering by list of databases in the file.

xtrabackup --backup --databases-file=~/databases_list --target-dir=/b -ubackup -p

Using server version 8.0.26
231205 15:36:08 Executing LOCK INSTANCE FOR BACKUP...
xtrabackup: uses posix_fadvise().
xtrabackup: cd to /var/lib/mysql
xtrabackup: open files limit requested 0, set to 1048576
xtrabackup: using the following InnoDB configuration:
xtrabackup:   innodb_data_home_dir = .
xtrabackup:   innodb_data_file_path = ibdata1:12M:autoextend
xtrabackup:   innodb_log_group_home_dir = ./
xtrabackup:   innodb_log_files_in_group = 2
xtrabackup:   innodb_log_file_size = 50331648
Number of pools: 1
xtrabackup: cannot open ~/databases_list

databases_list File contents

fund
call

Welcome to Percona Community @Yonghui_Chen,

The following error some how hints me at permissions issue?

xtrabackup: cannot open ~/databases_list

Can you check if ~/databases_list is accessible to the user executing XB command?

Thanks,
K

I used the XB command executed by the root user of centos 7, and I also used the root user of the database to connect, and changed the file permission to 777, and I still get same error

Hi @Yonghui_Chen ,

Please use full path for --databases-file , like /home/your_user/databases_list .
Let us know if it works.

It works.
xtrabackup --backup --databases-file=/root/databases_list --target-dir=/root/b -ubackup -p,NO ERRORS

xtrabackup --backup --databases-file=~/databases_list --target-dir=~/b -ubackup -p,cannot open ~/databases_list