大网数据广告活动
服务器运维问答

mariabackup fails with Error: cannot mkdir 2: /data/backups/mariadb/

· 52CE 我爱测

Trying to use mariabackup to take backup of all our databases. First created backup directory as mkdir -p /mnt/data/backup/mariadb chown -R mysql:mysql /mnt/data/backup/mariadb And proceed to do backup # mariabackup --backup --ta…

问题原文

原帖链接 · Joel Divekar · CC BY-SA 4.0

Trying to use mariabackup to take backup of all our databases. First created backup directory as

mkdir -p /mnt/data/backup/mariadb
chown -R mysql:mysql /mnt/data/backup/mariadb

And proceed to do backup

# mariabackup --backup --target-dir=/mnt/data/backups/mariadb/ --user=root --password=xxxxxxxx
[00] 2022-02-06 11:28:46 Connecting to MySQL server host: localhost, user: root, password: set, port: not set, socket: /mnt/data/mysql/mysql.sock
[00] 2022-02-06 11:28:46 Using server version 10.3.28-MariaDB
mariabackup based on MariaDB server 10.3.28-MariaDB Linux (x86_64)
[00] 2022-02-06 11:28:46 uses posix_fadvise().
[00] 2022-02-06 11:28:46 cd to /mnt/data/mysql/
[00] 2022-02-06 11:28:46 open files limit requested 0, set to 1024
[00] 2022-02-06 11:28:46 mariabackup: using the following InnoDB configuration:
[00] 2022-02-06 11:28:46 innodb_data_home_dir = 
[00] 2022-02-06 11:28:46 innodb_data_file_path = ibdata1:12M:autoextend
[00] 2022-02-06 11:28:46 innodb_log_group_home_dir = ./
[00] 2022-02-06 11:28:46 InnoDB: Using Linux native AIO
2022-02-06 11:28:46 0 [Note] InnoDB: Number of pools: 1
[00] 2022-02-06 11:28:46 Error: cannot mkdir 2: /mnt/data/backups/mariadb/

tried goggling and various options it did not worked so finally tried without --target-directory option and did backup again and it worked successfully and got this

# ls -ld /mnt/data/backup
drwxr-xr-x 3 mysql mysql 21 Feb  6 11:41 /mnt/data/backup

# pwd
/mnt/data/mysql

# ll
total 8
drwxr-xr-x  3 mysql mysql   21 Feb  6 11:41 backup
drwxr-xr-x 27 mysql mysql 4096 Feb  4 19:07 mysql
drwx------ 27 root  root  4096 Feb  6 11:22 xtrabackup_backupfiles

What did I do wrong or how do I run this with ----target-directory

已采纳解答

原帖链接 · Tilman Schmidt · CC BY-SA 4.0

You've got a typo in your commands. The commands

mkdir -p /mnt/data/backup/mariadb
chown -R mysql:mysql /mnt/data/backup/mariadb

created the directory /mnt/data/backup/mariadb but the command

mariabackup --backup --target-dir=/mnt/data/backups/mariadb/ ...

asked mariabackup to write to /mnt/data/backups/mariadb. The parent directory /mnt/data/backups of that directory probably does not exist. Since mariabackup as per its manpage only creates the target directory itself if necessary, but not the path leading to it, it errored out.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2022-02-06)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。