Hi all, mariadb appears to be broken on my server.
$ mariadb
ERROR 2002 (HY000): Can't connect to local server through socket '/run/mysqld/mysqld.sock' (2)
I’m at a bit at a loss of how to fix this issue, I’ve tried looking online, this error is mentioned in a few places, but the solutions for Ubuntu Server aren’t clear to me.
I’m trying to re-install Zoneminder, but need to fix maridb first.
Can anyone suggest any first steps to take to determine the issue?
$ sudo service mysqld start
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.
Following the advice in the above…
Trying: systemctl status mariadb.service
$ systemctl status mariadb.service
× mariadb.service - MariaDB 10.6.18 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2025-01-24 21:43:21 GMT; 2min 36s ago
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Process: 28811 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Process: 28814 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 28816 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, stat>
Process: 28847 ExecStart=/usr/sbin/mariadbd $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
Main PID: 28847 (code=exited, status=1/FAILURE)
Status: "MariaDB server is down"
CPU: 118ms
Jan 24 21:43:21 hal systemd[1]: Starting MariaDB 10.6.18 database server...
Jan 24 21:43:21 hal mariadbd[28847]: 2025-01-24 21:43:21 0 [Warning] Can't create test file '/var/lib/mysql/hal.lower-test' (Errcode: 2 "No such file or directory")
Jan 24 21:43:21 hal mariadbd[28847]: [99B blob data]
Jan 24 21:43:21 hal mariadbd[28847]: 2025-01-24 21:43:21 0 [ERROR] Aborting
Jan 24 21:43:21 hal systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jan 24 21:43:21 hal systemd[1]: mariadb.service: Failed with result 'exit-code'.
Jan 24 21:43:21 hal systemd[1]: Failed to start MariaDB 10.6.18 database server.
And: journalctl -xeu mariadb.service
$ journalctl -xeu mariadb.service
░░
░░ An ExecStart= process belonging to unit mariadb.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
Jan 23 22:58:10 hal systemd[1]: mariadb.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ The unit mariadb.service has entered the 'failed' state with result 'exit-code'.
Jan 23 22:58:10 hal systemd[1]: Failed to start MariaDB 10.6.18 database server.
░░ Subject: A start job for unit mariadb.service has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit mariadb.service has finished with a failure.
░░
░░ The job identifier is 2322 and the job result is failed.
Jan 23 22:58:10 hal systemd[1]: mariadb.service: Consumed 1.012s CPU time.
░░ Subject: Resources consumed by unit runtime
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ The unit mariadb.service completed and consumed the indicated resources.
Jan 24 21:43:21 hal systemd[1]: Starting MariaDB 10.6.18 database server...
░░ Subject: A start job for unit mariadb.service has begun execution
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit mariadb.service has begun execution.
░░
░░ The job identifier is 12418.
Jan 24 21:43:21 hal mariadbd[28847]: 2025-01-24 21:43:21 0 [Warning] Can't create test file '/var/lib/mysql/hal.lower-test' (Errcode: 2 "No such file or directory")
Jan 24 21:43:21 hal mariadbd[28847]: [99B blob data]
Jan 24 21:43:21 hal mariadbd[28847]: 2025-01-24 21:43:21 0 [ERROR] Aborting
Jan 24 21:43:21 hal systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ An ExecStart= process belonging to unit mariadb.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
Jan 24 21:43:21 hal systemd[1]: mariadb.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ The unit mariadb.service has entered the 'failed' state with result 'exit-code'.
Jan 24 21:43:21 hal systemd[1]: Failed to start MariaDB 10.6.18 database server.
░░ Subject: A start job for unit mariadb.service has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit mariadb.service has finished with a failure.
░░
░░ The job identifier is 12418 and the job result is failed.
Hopefully there may be some clues in the above info.
Thank you - looking at it, I think that’s the guide I followed to install it in the first instance, some years ago.
I’ll try a re-install and then go form there.
I think it MariaDB got upset as the OS HDD became filled up, ironically it was consumed by a massive database as part of zoneminder CCTV recorder. The image files are all held on another drive, and these are managed effectively by deleting old images when the drive gets to 95% full… but the main OS drive with the program is where the database was, and manually deleting all files associated with zoneminder freed up about 100 GB of space! Madness!
I gave it a full apt remove of mariadb-server, mariadb-client and anything else I could find with mariadb in the name, and re-installed as per the instructions provided.
But before re-installing I upgraded Ubuntu to the latest version, and ensured any other bugs were ironed out.
It now works well, and now Zoneminder is re-installed and working again. Ill keep a closer eye on the space Zoneminder’s database consumes, and manually delete older records.