I am running MariaDB 10.3.22 on a Raspberry Pi 3 with Raspbian Buster, using the InnoDB engine. Due to a power outage on my RPI, a table on my innodb_system
tablespace corrupted. I eventually managed to get MySQL running by force of inserting innodb_force_recovery = 5
on mariadb.conf.d/50-server.cnf
, but coming the moment to run mysqldump
, it fails with this error:
# 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
Googling "mysqldump error: Found option without preceding group in config file" brought me many search results saying it's because my configuration directory was missing a [mysqld]
section. However, this is not the case:
# grep -r "\[mysqld\]" /etc/mysql/*
/etc/mysql/mariadb.cnf:[mysqld]
/etc/mysql/my.cnf:[mysqld]
I get the same error when attempting to dump one database at a time with mysqldump -u root -p --databases <a database>
.
This leaves me with no option for now but to manually dump my database tables one by one with SQL queries like select * from innodb_sys_tablespaces into outfile '/media/USB/mysql-backups/information_schema-innodb_sys_tablespaces.sql';
; even if I wrote a script to avoid doing this manually, it would be a quite a task to get that script right.
Is there any way to fix this issue and get mysqldump
running before commiting myself to a time-consuming table-by-table recovery attempt?
This is the content of my my.cnf
file:
[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
This is the guide I was using to recover my databases: https://stackoverflow.com/questions/15304708/recover-mysql-database-from-ibdata1
0 Answers