published under license CC-BY
posted in category Systems Software / MySQL & MariaDB
posted at 07. Oct '25
Howto (unsuccessfully) Repair MariaDB Database
$ mysqlcheck -u root -p --auto-repair --check --all-databases
You should see something like:
Enter password:
matomo.matomo_access OK
matomo.matomo_archive_blob_2024_01 OK
matomo.matomo_archive_blob_2024_02 OK
matomo.matomo_archive_blob_2024_03 OK
matomo.matomo_archive_blob_2024_04 OK
matomo.matomo_archive_blob_2024_05 OK
matomo.matomo_archive_blob_2024_06 OK
matomo.matomo_archive_blob_2024_07 OK
matomo.matomo_archive_blob_2024_08 OK
matomo.matomo_archive_blob_2024_09 OK
matomo.matomo_archive_blob_2024_10 OK
matomo.matomo_archive_blob_2024_11 OK
matomo.matomo_archive_invalidations OK
matomo.matomo_log_link_visit_action
Warning : InnoDB: Index index_idsite_servertime is marked as corrupted
error : Corrupt
matomo.matomo_log_profiling OK
matomo.matomo_log_visit
Warning : InnoDB: Index index_idsite_config_datetime is marked as corrupted
Warning : InnoDB: Index index_idsite_idvisitor_time is marked as corrupted
error : Corrupt
matomo.matomo_logger_message OK
matomo.matomo_option
Warning : InnoDB: Index autoload is marked as corrupted
error : Corrupt
matomo.matomo_plugin_setting OK
matomo.matomo_privacy_logdata_anonymizations OK
matomo.matomo_report OK
matomo.matomo_report_subscriptions OK
matomo.matomo_segment OK
matomo.matomo_sequence
Error : Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
error : Corrupt
Repairing tables
matomo.matomo_log_link_visit_action
note : The storage engine for the table doesn't support repair
matomo.matomo_log_visit
note : The storage engine for the table doesn't support repair
matomo.matomo_option
note : The storage engine for the table doesn't support repair
matomo.matomo_sequence
Error : Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
error : Corrupt
In my case it didn't help at all and mariadb still failed with a segfault and I had to delete the corrupted database:
2024-10-07T00:55:55.626698+02:00 starz systemd[1]: Started mariadb.service - MariaDB 10.11.6 database server.
2024-10-07T00:55:55.662972+02:00 starz mysqld[113884]: /usr/sbin/mariadbd(+0xd55f4a)[0x558a168e3f4a]
2024-10-07T00:55:55.663849+02:00 starz mysqld[113884]: /usr/sbin/mariadbd(+0x6b0478)[0x558a1623e478]
2024-10-07T00:55:55.664879+02:00 starz mysqld[113884]: /usr/sbin/mariadbd(+0xe5f87b)[0x558a169ed87b]
2024-10-07T00:55:55.665843+02:00 starz mysqld[113884]: /usr/sbin/mariadbd(+0xd9265b)[0x558a1692065b]
2024-10-07T00:55:55.666801+02:00 starz mysqld[113884]: /usr/sbin/mariadbd(+0xd4ff01)[0x558a168ddf01]
2024-10-07T00:55:55.667701+02:00 starz mysqld[113884]: /usr/sbin/mariadbd(+0xdb030e)[0x558a1693e30e]
2024-10-07T00:55:55.668620+02:00 starz mysqld[113884]: /usr/sbin/mariadbd(+0xdb0722)[0x558a1693e722]
2024-10-07T00:55:55.669356+02:00 starz mysqld[113884]: /usr/sbin/mariadbd(+0x695c38)[0x558a16223c38]
2024-10-07T00:55:55.670441+02:00 starz mysqld[113884]: /usr/sbin/mariadbd(_ZN5tpool10task_group7executeEPNS_4taskE+0x74)[0x558a169f6c84]
2024-10-07T00:55:55.671510+02:00 starz mysqld[113884]: /usr/sbin/mariadbd(_ZN5tpool19thread_pool_generic11worker_mainEPNS_11worker_dataE+0x57)[0x558a169f5087]
2024-10-07T00:55:55.738626+02:00 starz mysqld[113884]: The manual page at https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mariadbd/ contains
2024-10-07T00:55:55.738642+02:00 starz kernel: [14066.700629] mariadbd[1462129]: segfault at 40 ip 0000558a168e3f4a sp 00007fdc83dfed00 error 4 in mariadbd[d55f4a,558a161e8000+91d000] likely on CPU 19 (core 19, socket 0)
2024-10-07T00:55:55.764176+02:00 starz systemd[1]: mariadb.service: Main process exited, code=killed, status=11/SEGV
2024-10-07T00:55:55.771647+02:00 starz systemd[1]: mariadb.service: Failed with result 'signal'.
2024-10-07T00:56:00.985830+02:00 starz systemd[1]: mariadb.service: Scheduled restart job, restart counter is at 480.
2024-10-07T00:56:00.985990+02:00 starz systemd[1]: Stopped mariadb.service - MariaDB 10.11.6 database server.
Initialize new database:
root@starz:/var/lib# mysql_install_db
Installing MariaDB/MySQL system tables in '/var/lib/mysql' ...
2024-10-07 1:06:10 1 [Warning] Failed to load slave replication state from table mysql.gtid_slave_pos: 1017: Can't find file: './mysql/' (errno: 2 "No such file or directory")
OK
To start mariadbd at boot time you have to copy
support-files/mariadb.service to the right place for your system
Two all-privilege accounts were created.
One is root@localhost, it has no password, but you need to
be system 'root' user to connect. Use, for example, sudo mysql
The second is mysql@localhost, it has no password either, but
you need to be the system 'mysql' user to connect.
After connecting you can set the password, if you would need to be
able to connect as any of these users with a password and without sudo
See the MariaDB Knowledgebase at https://mariadb.com/kb
You can start the MariaDB daemon with:
cd '/usr' ; /usr/bin/mariadb-safe --datadir='/var/lib/mysql'
You can test the MariaDB daemon with mysql-test-run.pl
cd '/usr/share/mysql/mysql-test' ; perl mariadb-test-run.pl
Please report any problems at https://mariadb.org/jira
The latest information about MariaDB is available at https://mariadb.org/.
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/
And now load a backup or, well, set up everything again if there were no backups.
Add Comment