Se alterou ou moveu a pasta /var/lib/mysql de lugar e, ao mover para o local de origem, perdeu as permissões e o MariaDB ou MySQL não inicia mais fazendo o seguinte erro aparecer:
Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xeu mariadb.service" for details.
Para solucionar execute os seguintes comandos:
sudo chown -R mysql:mysql /var/lib/mysql
sudo chmod -R 750 /var/lib/mysql
Erro
Abaixo posto log de erro que aparece ao executarmos “journalctl -xeu mariadb.service”
root@debian12:~# journalctl -xeu mariadb
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ A unidade mariadb.service falhou.
░░
░░ O resultado é failed.
mai 07 17:26:02 debian12 systemd[1]: Starting mariadb.service - MariaDB 10.11.6 database server...
░░ Subject: Unidade mariadb.service sendo iniciado
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ A unidade mariadb.service está sendo iniciada.
mai 07 17:26:02 debian12 mariadbd[4914]: 2024-05-07 17:26:02 0 [Warning] Can't create test file '/var/lib/mysql/debian12.lowe>
mai 07 17:26:02 debian12 mariadbd[4914]: [92B blob data]
mai 07 17:26:02 debian12 mariadbd[4914]: 2024-05-07 17:26:02 0 [ERROR] Aborting
mai 07 17:26:02 debian12 systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ An ExecStart= process belonging to unit mariadb.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
mai 07 17:26:02 debian12 systemd[1]: mariadb.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ The unit mariadb.service has entered the 'failed' state with result 'exit-code'.
mai 07 17:26:02 debian12 systemd[1]: Failed to start mariadb.service - MariaDB 10.11.6 database server.
░░ Subject: A unidade mariadb.service falhou
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ A unidade mariadb.service falhou.
░░
░░ O resultado é failed.