MariaDB 10.3.22 for RPI 以 innodb_force_recovery = 5 启动:mysqldump 失败,声称“[mysqld]”不在配置中,但实际上存在

MariaDB 10.3.22 for RPI 以 innodb_force_recovery = 5 启动:mysqldump 失败,声称“[mysqld]”不在配置中,但实际上存在

我在装有 Raspbian Buster 的 Raspberry Pi 3 上运行 MariaDB 10.3.22,使用 InnoDB 引擎。由于我的 RPI 断电,我的innodb_system表空间上的一个表损坏了。我最终设法通过强制插入来运行 MySQL innodb_force_recovery = 5mariadb.conf.d/50-server.cnf但到了运行 的时刻mysqldump,它失败并出现此错误:

# mysqldump -u root -p --all-databases > mysqlbackup.sql
error: Found option without preceding group in config file: /etc/mysql/my.cnf at line: 1
Fatal error in defaults handling. Program aborted

谷歌搜索“mysqldump 错误:在配置文件中发现没有前置组的选项”给我带来了很多搜索结果,说这是因为我的配置目录缺少一个[mysqld]部分。然而,事实并非如此:

# grep -r "\[mysqld\]" /etc/mysql/*
/etc/mysql/mariadb.cnf:[mysqld]
/etc/mysql/my.cnf:[mysqld]

当我尝试使用 一次转储一个数据库时,出现了同样的错误mysqldump -u root -p --databases <a database>

这让我现在别无选择,只能使用类似的 SQL 查询手动逐个转储我的数据库表select * from innodb_sys_tablespaces into outfile '/media/USB/mysql-backups/information_schema-innodb_sys_tablespaces.sql';;即使我编写了一个脚本来避免手动执行此操作,但要正确执行该脚本也是一项相当艰巨的任务。

mysqldump在进行耗时的逐表恢复尝试之前,有没有什么方法可以解决这个问题并开始运行?

my.cnf这是我的文件的内容:

[mysqld]
[client-server]

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/

# The MariaDB configuration file
#
# The MariaDB/MySQL tools read configuration files in the following order:
# 1. "/etc/mysql/mariadb.cnf" (this file) to set global defaults,
# 2. "/etc/mysql/conf.d/*.cnf" to set global options.
# 3. "/etc/mysql/mariadb.conf.d/*.cnf" to set MariaDB-only options.
# 4. "~/.my.cnf" to set user-specific options.
#
# If the same option is defined multiple times, the last one will apply.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.

#
# This group is read both both by the client and the server
# use it for options that affect everything
#

# Import all .cnf files from configuration directory

这是我用来恢复数据库的指南:https://stackoverflow.com/questions/15304708/recover-mysql-database-from-ibdata1

相关内容