[Solved] Error! MariaDB is not running on your system - database list could not be retrieved

Everything has been working well for several months, and today I go to the server and see that the database is not running, and does not want to start and gives an error… I urgently need to solve this problem so as not to lose the database of my site(

I am attaching screenshots:

screen 1

screen 2

Device: ODROID-HC1
Version DietPi: v8.5.1
SD Card: Sandisk 16gb

can you share following

systemctl restart mariadb.service
journalctl -u mariadb
cat /var/log/mysql/error.log
readlink /var/lib/mysql
readlink -f /var/lib/mysql

btw: if possible try to avoid screen prints. You should be able to copy everything from SSH terminal directly.

root@DietPi:~# systemctl restart mariadb.service
Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details.
root@DietPi:~# systemctl status mariadb.service
● mariadb.service - MariaDB 10.5.15 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; disabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Wed 2022-07-20 14:12:22 EEST; 5s ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 9656 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
    Process: 9657 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 9659 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
    Process: 9706 ExecStart=/usr/sbin/mariadbd $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
   Main PID: 9706 (code=exited, status=1/FAILURE)
     Status: "MariaDB server is down"
        CPU: 4.409s

Jul 20 14:12:21 DietPi mariadbd[9706]: 2022-07-20 14:12:21 0 [Note] InnoDB: Starting shutdown...
Jul 20 14:12:22 DietPi mariadbd[9706]: 2022-07-20 14:12:22 0 [ERROR] Plugin 'InnoDB' init function returned error.
Jul 20 14:12:22 DietPi mariadbd[9706]: 2022-07-20 14:12:22 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
Jul 20 14:12:22 DietPi mariadbd[9706]: 2022-07-20 14:12:22 0 [Note] Plugin 'FEEDBACK' is disabled.
Jul 20 14:12:22 DietPi mariadbd[9706]: 2022-07-20 14:12:22 0 [ERROR] Unknown/unsupported storage engine: InnoDB
Jul 20 14:12:22 DietPi mariadbd[9706]: 2022-07-20 14:12:22 0 [ERROR] Aborting
Jul 20 14:12:22 DietPi systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jul 20 14:12:22 DietPi systemd[1]: mariadb.service: Failed with result 'exit-code'.
Jul 20 14:12:22 DietPi systemd[1]: Failed to start MariaDB 10.5.15 database server.
Jul 20 14:12:22 DietPi systemd[1]: mariadb.service: Consumed 4.409s CPU time.
root@DietPi:~# cat /var/log/mysql/error.log
cat: /var/log/mysql/error.log: No such file or directory
root@DietPi:~# readlink /var/lib/mysql
/mnt/dietpi_userdata/mysql
root@DietPi:~# readlink -f /var/lib/mysql
/mnt/dietpi_userdata/mysql
root@DietPi:~# 


I guess you missed to share following

journalctl -u mariadb

I tried this command, but it gives a very large result, which I cannot insert here in code due to the character limit on the forum)

so I am attaching a screenshot

screenshot

Looks like your data files got corrupted. Are there any information before the DUMP message starts?

As well you could try to run some file system check commands.

> /forcefsck
reboot
# then after reboot
journalctl -t systemd-fsck

I see that on path /mnt/dietpi_userdata/mysql there are folders with the base, how should I export the dump folder in sql?

I need to export one database, I can see it, but it is in a folder, and I need to somehow convert the dump to sql, since I have already transferred my site to another working server

screenshot db folder

and after run your command:

> /forcefsck
reboot
# then after reboot
journalctl -t systemd-fsck

result:

root@DietPi:~# journalctl -t systemd-fsck

-- Journal begins at Wed 2022-07-20 15:02:30 EEST, ends at Wed 2022-07-20 15:03:32 EEST. --

-- No entries --

root@DietPi:~#

I tried this command mysqldump -u username -p database_name > data-dump.sql
but

Enter password: 
mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2)" when trying to connect
root@DietPi:~# 

It might not be possible to export the database as the database server is not starting at the moment. According the log files you shared, it might be possible to set some flags to force the database to startup. MySQL :: MySQL 8.0 Reference Manual :: 15.21.3 Forcing InnoDB Recovery

Probably you would need to reach out to some MariaDB specialized boards for deeper database support.

i don’t know what to do now
I take it that I can’t export the database without running mariadb?

What if I make a copy of the contents of folder /mnt/dietpi_userdata/mysql, then delete mariadb and reinstall, and then copy the database folders back to /mnt/dietpi_userdata/mysql?

Is it possible to restore the database dump like this?

The problem is the files inside your database folder mysite@002dsite. Looks like MariaDB is not able to read these files anymore. Therefore the database server is not starting atm. Moving the files back in place on a new install will most probably result on the same. Therefore you could set force recovery option within MariaDB server configuration file. This should allow to start the database eninge. And maybe you are able to export this specific database later on.

Another option is to copy these specific mysite@002dsite folder away to a save place and try to start MariaDB afterwards. Maybe this will bring back Nextcloud at least.

mysite@002dsite is more important to me nextcloud(
how do i force MariaDB to start? Can you please show me in detail?

Did you tried moving mysite@002dsite folder away and to restart MariaDB?

yes, but that didn’t solve the problem. I am sure that the problem there is not because of this database, there is a site on modx without errors at all, I have its analogue working on another server and everything is perfect.

I made a copy of /mnt/dietpi_userdata/mysql and will now reinstall mariaDB

i reinstall mariadb success, but i trying create dump(
result:

root@DietPi:~# mysqldump -u root -p mysite-site > data-dump.sql

Enter password:

mysqldump: Couldn't execute 'SHOW FULL TABLES': Can't read dir of './mysite@002dsite/' (errno: 13 "Permission denied") (1018)

root@DietPi:~#

now i have one problem i have database dump in folder format how can i convert it to sql dump?)
I’m sure I’ve done it before, but I don’t know how…

I reinstalled cleanly MariaDB, created a database and a user with the same name and password, then copied the previously saved files to the folder /mnt/dietpi_userdata/mysql/mysite@002dsite/, and I get the following message in webmin((

Is it impossible for me to recover a dump of this database? I know for sure that she is working

show screenshots