Cannot Start Mariadb on Linux Ubuntu

Hello,

I am reaching out to you because I recently changed my linux server for a new one and after installing Mariadb on it while at the same time, adding a database for one of my site from my old server, I can't make Mariadb start properly.

I have been trying to find an answer for hours now and I've searched all over the internet and tried many different things but none of them seem to work.

I get this error log from "journalctl -xeu mariadb.service" :

déc. 07 19:25:52 P-KSWEB-A-01 systemd[1]: Starting MariaDB 11.1.3 database server... déc. 07 19:25:52 P-KSWEB-A-01 mariadbd[4713]: 2023-12-07 19:25:52 0 [Warning] Can't create test file '/var/lib/mysql/P-KSWEB-A-01.lower-test' (Errcode: 13 "Permission denied") déc. 07 19:25:52 P-KSWEB-A-01 mariadbd[4713]: 2023-12-07 19:25:52 0 [Note] Starting MariaDB 11.1.3-MariaDB-1:11.1.3+mariaubu2204 source revision 0f5613a25f27b8034645226a48c2dc1aa4562281 as process 4713 déc. 07 19:25:52 P-KSWEB-A-01 mariadbd[4713]: 2023-12-07 19:25:52 0 [ERROR] mariadbd: Can't create/write to file './ddl_recovery.log' (Errcode: 13 "Permission denied") déc. 07 19:25:52 P-KSWEB-A-01 mariadbd[4713]: 2023-12-07 19:25:52 0 [ERROR] DDL_LOG: Failed to create ddl log file: ./ddl_recovery.log déc. 07 19:25:52 P-KSWEB-A-01 mariadbd[4713]: 2023-12-07 19:25:52 0 [ERROR] Aborting déc. 07 19:25:52 P-KSWEB-A-01 systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE déc. 07 19:25:52 P-KSWEB-A-01 systemd[1]: mariadb.service: Failed with result 'exit-code'. déc. 07 19:25:52 P-KSWEB-A-01 systemd[1]: Failed to start MariaDB 11.1.3 database server. déc. 07 19:31:41 P-KSWEB-A-01 systemd[1]: Starting MariaDB 11.1.3 database server...

and this one when checking at "systemctl status mariadb" :

× mariadb.service - MariaDB 11.1.3 database server Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled) Drop-In: /etc/systemd/system/mariadb.service.d └─migrated-from-my.cnf-settings.conf Active: failed (Result: exit-code) since Thu 2023-12-07 19:31:41 CET; 21h ago Docs: man:mariadbd(8) https://mariadb.com/kb/en/library/systemd/ Process: 4894 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS) Process: 4895 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS) Process: 4897 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: 4926 ExecStart=/usr/sbin/mariadbd $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE) Main PID: 4926 (code=exited, status=1/FAILURE) Status: "MariaDB server is down" CPU: 75ms

I investigated the issue related to "Can't Create Test File" and I tried to find where my "datadir" was in "/etc/mysql/mysql.conf.d/mysqld.cnf", it showed me this path : "/data/mysql".

I've then checked the permissions there which seems to be part of the "Can't Create Test File" issue but I don't see any problem either since the folders seems to be executable by the owner and I don't understand where the glitch might be.

I've also tried to type : "restorecon -Rv /data/mysql" but it didn't change anything and it doesn't work either.

I include the "ls -laZ /data/mysql" to you in case that might help.

drwxr-xr-x 7 mysql mysql ? 4096 déc. 7 19:11 . Folder

drwxr-xr-x 5 root root ? 4096 nov. 29 13:50 .. Folder

-rw-r----- 1 mysql mysql ? 56 juin 23 2023 auto.cnf

-rw-r----- 1 mysql mysql ? 201 août 31 00:00 binlog.000072

-rw-r----- 1 mysql mysql ? 201 sept. 1 00:00 binlog.000073

-rw-r----- 1 mysql mysql ? 201 sept. 2 00:00 binlog.000074

-rw-r----- 1 mysql mysql ? 201 sept. 3 00:00 binlog.000075

-rw-r----- 1 mysql mysql ? 201 sept. 4 00:00 binlog.000076

-rw-r----- 1 mysql mysql ? 201 sept. 5 00:00 binlog.000077

-rw-r----- 1 mysql mysql ? 201 sept. 6 00:00 binlog.000078

-rw-r----- 1 mysql mysql ? 201 sept. 7 00:00 binlog.000079

-rw-r----- 1 mysql mysql ? 201 sept. 8 00:00 binlog.000080

-rw-r----- 1 mysql mysql ? 201 sept. 9 00:00 binlog.000081

-rw-r----- 1 mysql mysql ? 201 sept. 10 00:00 binlog.000082

-rw-r----- 1 mysql mysql ? 201 sept. 11 00:00 binlog.000083

-rw-r----- 1 mysql mysql ? 201 sept. 12 00:00 binlog.000084

-rw-r----- 1 mysql mysql ? 201 sept. 13 00:00 binlog.000085

-rw-r----- 1 mysql mysql ? 201 sept. 14 00:00 binlog.000086

-rw-r----- 1 mysql mysql ? 201 sept. 15 00:00 binlog.000087

-rw-r----- 1 mysql mysql ? 201 sept. 16 00:00 binlog.000088

-rw-r----- 1 mysql mysql ? 201 sept. 17 00:00 binlog.000089

-rw-r----- 1 mysql mysql ? 201 sept. 18 00:00 binlog.000090

-rw-r----- 1 mysql mysql ? 201 sept. 19 00:00 binlog.000091

-rw-r----- 1 mysql mysql ? 201 sept. 20 00:00 binlog.000092

-rw-r----- 1 mysql mysql ? 201 sept. 21 00:00 binlog.000093

-rw-r----- 1 mysql mysql ? 201 sept. 22 00:00 binlog.000094

-rw-r----- 1 mysql mysql ? 201 sept. 23 00:00 binlog.000095

-rw-r----- 1 mysql mysql ? 201 sept. 24 00:00 binlog.000096

-rw-r----- 1 mysql mysql ? 201 sept. 25 00:00 binlog.000097

-rw-r----- 1 mysql mysql ? 201 sept. 26 00:00 binlog.000098

-rw-r----- 1 mysql mysql ? 201 sept. 27 00:00 binlog.000099

-rw-r----- 1 mysql mysql ? 180 sept. 27 16:56 binlog.000100

-rw-r----- 1 mysql mysql ? 180 sept. 27 16:58 binlog.000101

-rw-r----- 1 mysql mysql ? 404 sept. 27 16:58 binlog.000102

-rw-r----- 1 mysql mysql ? 201 sept. 28 00:00 binlog.000103

-rw-r----- 1 mysql mysql ? 201 sept. 29 00:00 binlog.000104

-rw-r----- 1 mysql mysql ? 201 sept. 30 00:00 binlog.000105

-rw-r----- 1 mysql mysql ? 180 sept. 30 14:46 binlog.000106

-rw-r----- 1 mysql mysql ? 560 sept. 30 00:00 binlog.index

-rw------- 1 mysql mysql ? 1705 juin 23 2023 ca-key.pem

-rw-r--r-- 1 mysql mysql ? 1112 juin 23 2023 ca.pem

-rw-r--r-- 1 mysql mysql ? 1112 juin 23 2023 client-cert.pem

-rw------- 1 mysql mysql ? 1705 juin 23 2023 client-key.pem

-rw-r--r-- 1 root root ? 0 juin 23 2023 debian-5.7.flag

-rw-r----- 1 mysql mysql ? 196608 sept. 30 00:00 '#ib_16384_0.dblwr'

-rw-r----- 1 mysql mysql ? 8585216 sept. 27 16:58 '#ib_16384_1.dblwr'

-rw-r----- 1 mysql mysql ? 4181 sept. 30 14:46 ib_buffer_pool

-rw-r----- 1 mysql mysql ? 12582912 sept. 30 14:46 ibdata1

drwxr-x--- 2 mysql mysql ? 4096 sept. 27 16:58 '#innodb_redo' Folder

drwxr-x--- 2 mysql mysql ? 4096 sept. 30 14:46 '#innodb_temp' Folder

drwxr-x--- 2 mysql mysql ? 4096 sept. 27 16:58 mysql Folder

-rw-r----- 1 mysql mysql ? 30408704 sept. 27 16:58 mysql.ibd

-rw-r----- 1 mysql mysql ? 6 sept. 27 16:58 mysql_upgrade_info

drwxr-x--- 2 mysql mysql ? 4096 juin 23 2023 performance_schema Folder

-rw------- 1 mysql mysql ? 1705 juin 23 2023 private_key.pem

-rw-r--r-- 1 mysql mysql ? 452 juin 23 2023 public_key.pem

-rw-r--r-- 1 mysql mysql ? 1112 juin 23 2023 server-cert.pem

-rw------- 1 mysql mysql ? 1705 juin 23 2023 server-key.pem

drwxr-x--- 2 mysql mysql ? 4096 juin 23 2023 sys Folder

-rw-r----- 1 mysql mysql ? 16777216 sept. 27 17:00 undo_001

-rw-r----- 1 mysql mysql ? 16777216 sept. 27 17:00 undo_002

Would you please have an idea of what might cause this and how to resolve it ?

Thank you so much in advance for your help and have a beautiful day.

Kind Regards, ml25

EDIT - ANSWER FOUND

_____

Hello,

I finally found the issue and I wanted to share it in case someone might get the same and doesn't found the answer.

It was indeed a problem of wrong usergroup for my "/var/lib/mysql" folder that I switched to "mysql" and it resolved the problem.

It is working perfectly now. Thanks all for your help !

Kind Regards, ml25

Answer Answered by ml25 lp in this comment.

Hello,

I finally found the issue and I wanted to share it in case someone might get the same and doesn't found the answer.

It was indeed a problem of wrong usergroup for my "/var/lib/mysql" folder that I switched to "mysql" and it resolved the problem.

It is working perfectly now. Thanks all for your help !

Kind Regards, ml25

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.