Mariadb help, cause I'm confused :(

okay so I did a fresh install of Mariaddb (to teach myself SQL and for Prelude) It won’t start. if I run

systemctl start mariadb.service 

I get errors, if I run

journalctl -xeu mariadb.service

I get
Dec 27 16:28:59 DebianTim mariadbd[45308]: Warning: Memory not freed: 280
Dec 27 16:28:59 DebianTim systemd[1]: mariadb.service: Main process exited, cod>
Subject: Unit process exited
Defined-By: systemd
Support: Debian -- User Support
An ExecStart= process belonging to unit mariadb.service has exited.
The process’ exit code is ‘exited’ and its exit status is 1.
Dec 27 16:28:59 DebianTim systemd[1]: mariadb.service: Failed with result 'exit>
Subject: Unit failed
Defined-By: systemd
Support: Debian -- User Support
The unit mariadb.service has entered the ‘failed’ state with result 'exit-co>
Dec 27 16:28:59 DebianTim systemd[1]: Failed to start MariaDB 10.6.11 database > Subject: A start job for unit mariadb.service has failed
Defined-By: systemd Support: Debian -- User Support
A start job for unit mariadb.service has finished with a failure.
The job identifier is 9298 and the job result is failed.

checklog shows:
2022-12-27T16:28:53.751970-06:00 DebianTim mariadb-server-10.6.postinst[45164]: 2022-12-27 16:28:53 0 [ERROR] mariadbd: Can’t create/write to file ‘/tmp/user/0/ib6BTPP5’ (Errcode: 13 “Permission denied”)
2022-12-27T16:28:53.752208-06:00 DebianTim mariadb-server-10.6.postinst[45164]: 2022-12-27 16:28:53 0 [ERROR] InnoDB: Unable to create temporary file; errno: 13
2022-12-27T16:28:53.752294-06:00 DebianTim mariadb-server-10.6.postinst[45164]: 2022-12-27 16:28:53 0 [ERROR] mariadbd: Can’t create/write to file ‘/tmp/user/0/ibpX1e2i’ (Errcode: 13 “Permission denied”)
2022-12-27T16:28:53.752352-06:00 DebianTim mariadb-server-10.6.postinst[45164]: 2022-12-27 16:28:53 0 [ERROR] InnoDB: Unable to create temporary file; errno: 13
2022-12-27T16:28:53.752399-06:00 DebianTim mariadb-server-10.6.postinst[45164]: 2022-12-27 16:28:53 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2022-12-27T16:28:53.852282-06:00 DebianTim mariadb-server-10.6.postinst[45164]: 2022-12-27 16:28:53 0 [ERROR] Plugin ‘InnoDB’ init function returned error.
2022-12-27T16:28:53.852444-06:00 DebianTim mariadb-server-10.6.postinst[45164]: 2022-12-27 16:28:53 0 [ERROR] Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed.
2022-12-27T16:28:53.852517-06:00 DebianTim mariadb-server-10.6.postinst[45164]: 2022-12-27 16:28:53 0 [ERROR] Unknown/unsupported storage engine: InnoDB
2022-12-27T16:28:53.852609-06:00 DebianTim mariadb-server-10.6.postinst[45164]: 2022-12-27 16:28:53 0 [ERROR] Aborting
2022-12-27T16:28:53.911648-06:00 DebianTim mariadb-server-10.6.postinst[45164]:
2022-12-27T16:28:53.911808-06:00 DebianTim mariadb-server-10.6.postinst[45164]: Installation of system tables failed! Examine the logs in
2022-12-27T16:28:53.911870-06:00 DebianTim mariadb-server-10.6.postinst[45164]: /var/lib/mysql for more information.
2022-12-27T16:28:53.911922-06:00 DebianTim mariadb-server-10.6.postinst[45164]:
2022-12-27T16:28:53.911971-06:00 DebianTim mariadb-server-10.6.postinst[45164]: The problem could be conflicting information in an external
2022-12-27T16:28:53.912022-06:00 DebianTim mariadb-server-10.6.postinst[45164]: my.cnf files. You can ignore these by doing:
2022-12-27T16:28:53.912073-06:00 DebianTim mariadb-server-10.6.postinst[45164]:
2022-12-27T16:28:53.912118-06:00 DebianTim mariadb-server-10.6.postinst[45164]: shell> /usr/bin/mysql_install_db --defaults-file=~/.my.cnf
2022-12-27T16:28:53.912178-06:00 DebianTim mariadb-server-10.6.postinst[45164]:
2022-12-27T16:28:53.917781-06:00 DebianTim mariadb-server-10.6.postinst[45164]: You can also try to start the mysqld daemon with:
2022-12-27T16:28:53.917919-06:00 DebianTim mariadb-server-10.6.postinst[45164]:
2022-12-27T16:28:53.918132-06:00 DebianTim mariadb-server-10.6.postinst[45164]: shell> /usr/sbin/mariadbd --skip-grant-tables --general-log &
2022-12-27T16:28:53.918224-06:00 DebianTim mariadb-server-10.6.postinst[45164]:
2022-12-27T16:28:53.918279-06:00 DebianTim mariadb-server-10.6.postinst[45164]: and use the command line tool /usr/bin/mariadb
2022-12-27T16:28:53.918332-06:00 DebianTim mariadb-server-10.6.postinst[45164]: to connect to the mysql database and look at the grant tables:
2022-12-27T16:28:53.918388-06:00 DebianTim mariadb-server-10.6.postinst[45164]:
2022-12-27T16:28:53.918438-06:00 DebianTim mariadb-server-10.6.postinst[45164]: shell> /usr/bin/mysql -u root mysql
2022-12-27T16:28:53.918489-06:00 DebianTim mariadb-server-10.6.postinst[45164]: mysql> show tables;
2022-12-27T16:28:53.918550-06:00 DebianTim mariadb-server-10.6.postinst[45164]:
2022-12-27T16:28:53.918599-06:00 DebianTim mariadb-server-10.6.postinst[45164]: Try ‘mysqld --help’ if you have problems with paths. Using
2022-12-27T16:28:53.918650-06:00 DebianTim mariadb-server-10.6.postinst[45164]: --general-log gives you a log in /var/lib/mysql that may be helpful.
2022-12-27T16:28:53.918704-06:00 DebianTim mariadb-server-10.6.postinst[45164]:
2022-12-27T16:28:53.918753-06:00 DebianTim mariadb-server-10.6.postinst[45164]: The latest information about mysql_install_db is available at
2022-12-27T16:28:53.918804-06:00 DebianTim mariadb-server-10.6.postinst[45164]: Installing System Tables (mariadb-install-db) - MariaDB Knowledge Base
2022-12-27T16:28:53.918854-06:00 DebianTim mariadb-server-10.6.postinst[45164]: You can find the latest source at https://downloads.mariadb.org and
2022-12-27T16:28:53.918903-06:00 DebianTim mariadb-server-10.6.postinst[45164]: the maria-discuss email list at Maria Discuss in Launchpad
2022-12-27T16:28:53.918956-06:00 DebianTim mariadb-server-10.6.postinst[45164]:
2022-12-27T16:28:53.919009-06:00 DebianTim mariadb-server-10.6.postinst[45164]: Please check all of the above before submitting a bug report
2022-12-27T16:28:53.919059-06:00 DebianTim mariadb-server-10.6.postinst[45164]: at https://mariadb.org/jira
2022-12-27T16:28:53.919126-06:00 DebianTim mariadb-server-10.6.postinst[45164]:
2022-12-27T16:28:54.044998-06:00 DebianTim kernel: [22048.428144] audit: type=1400 audit(1672180133.995:78): apparmor=“STATUS” operation=“profile_remove” info=“profile does not exist” error=-2 profile=“unconfined” name=“/usr/sbin/mariadbd” pid=45204 comm=“apparmor_parser”

systemctl status mariadb.service
× mariadb.service - MariaDB 10.6.11 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Tue 2022-12-27 16:28:59 CST; 1h 59min ago
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Process: 45275 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Process: 45276 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 45278 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`cd /usr/bin/…; /usr/bin/galera_recover>
Process: 45308 ExecStart=/usr/sbin/mariadbd $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
Main PID: 45308 (code=exited, status=1/FAILURE)
Status: “MariaDB server is down”
CPU: 157ms
There’s nothing in /var/log/mysql or in /var/lib/mysql either.
Just typing sudo mysql gives this:
ERROR 2002 (HY000): Can’t connect to local server through socket ‘/run/mysqld/mysqld.sock’ (111)
so yeah, I’m confused :crazy_face:

Check if this is AppArmor related. Do:
sudo systemctl stop apparmor.service

Then retry.

I did and still got:
sudo systemctl start mariadb.service
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.
I went to MariaDB’s knowledge base and found this:
systemctl sockets
Which basically states use this command:

systemctl start mariadb.socket

Which almost got it to start, but now complains about the handshake failing?
udo mysql
ERROR 2013 (HY000): Lost connection to server at ‘handshake: reading initial communication packet’, system error: 104
Ugh back to reading, futhermucker :cry:

Check to see if this line is in my.cnf:

bind-address = 127.0.0.1

If it is, delete it and try again. Can solve after if that works.

Also, temp-disable any local system firewalls.

I commented out that line (used #) and still get:
sudo systemctl start mariadb.socket
tmick@DebianTim:~$ mysql -u root -p
Enter password:
ERROR 2013 (HY000): Lost connection to server at ‘handshake: reading initial communication packet’, system error: 104
I also stopped NFTables and same result :sob:

Ouch! Well, the good thing about Linux is that with enough time and research, you will figure it out. But off my head, that’s all I can think of at the moment.

Well if I try this I get the following:
sudo mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we’ll need the current
password for the root user. If you’ve just installed MariaDB, and
haven’t set the root password yet, you should just press enter here.

Enter current password for root (enter for none):
ERROR 2013 (HY000): Lost connection to server at ‘handshake: reading initial communication packet’, system error: 104
Enter current password for root (enter for none):
ERROR 2002 (HY000): Can’t connect to local server through socket ‘/run/mysqld/mysqld.sock’ (111)
Enter current password for root (enter for none):
and doesn’t accept any passwords or even hitting enter.
sigh looks like time to get on a mailing list again.

So I contacted the mailing list for Maria (Maria-discuss) and was told to run

mysql_install_db

to initialize the DB, I was still getting errors and was told to run

chown -R mysql:mysql /var/lib/mysql

and restart Maria. It works! Apparently I had the wrong permissions? Anyway it works other than Prewikka (the interface to prelude) doesn’t load (error 404)

1 Like

Thanks for closing this off with a solution. I’m sure others will run into the same issue.

1 Like