Job for mariadb.service failed: how to find the real reason
Failed to start MariaDB 11.4 database server.Short answer
The systemd message is only a wrapper. The reason is in the MariaDB error log and the journal. Three documented causes are an unknown or misspelled option in a config file, another mariadbd already holding the data directory, and a buffer pool larger than the memory the machine has.
Fix it fast
1Find out which cause you have
Show the last journal lines for the unit and find the error log path the server is configured to use.
sudo journalctl -u mariadb.service -n 30 --no-pager mariadbd --help --verbose | grep 'log-error' | tail -12Match what you see, then jump to its fix
- 1
mariadbd: unknown variable 'option=value'A config file has an unknown optionFix - 2
Can't lock aria control file '/var/lib/mysql/aria_log_control' for exclusive use, error: 11Another mariadbd already uses the data directoryFix - 3
InnoDB: Fatal error: cannot allocate memory for the buffer poolThe InnoDB buffer pool is bigger than the available memoryFix
- 1
What does the error look like?
Failed to start MariaDB 11.4 database server.Unit mariadb.service entered failed state.
Cause 1 of 3
A config file has an unknown option
1Check
List the options the server will read from all option files, and look for the one it rejects. Option names are case-sensitive.
mariadbd --print-defaults2Fix
Remove or rename the option, correct its value, or fix the typo, in the file that contains it.
sudo grep -R -n "the_option_name" /etc/mysql/ /etc/my.cnf /etc/my.cnf.d/ 2>/dev/null3Verify
Start the service.
sudo systemctl start mariadbConfirmed by mariadb.com
Cause 2 of 3
Another mariadbd already uses the data directory
1Check
The same message family appears as InnoDB: Unable to lock ./ibdata1 error: 11. Look for a server process that is still running, such as a leftover from a manual start.
ps aux | grep -E 'mariadbd|mysqld' | grep -v grep2Fix
Stop the other instance, then start the service. File locking that does not work on some NFS mounts is a less likely cause of the same message.
sudo systemctl stop mariadb
sudo systemctl start mariadb3Verify
Only one server process is left and the unit is active.
systemctl is-active mariadbConfirmed by mariadb.com
Cause 3 of 3
The InnoDB buffer pool is bigger than the available memory
1Check
Compare the configured innodb_buffer_pool_size with the memory on the machine.
free -m
mariadbd --print-defaults | tr ' ' '\n' | grep -i buffer_pool2Fix
Add memory or lower innodb_buffer_pool_size in the config file.
[mysqld]
innodb_buffer_pool_size=512M3Verify
Start the service.
sudo systemctl start mariadbConfirmed by mariadb.com
How do I stop it coming back?
- Run mariadbd --print-defaults after every config edit, before restarting.
- Stop a hand-started server before using the service.
- Size innodb_buffer_pool_size for the machine, not for a bigger one you copied the config from.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- ShopGoAn e-commerce aggregator with a Python scraping engine behind its catalog, past 10K Google Play downloads.
Related fixes
Databases
systemctl start mariadb hangs, then fails with a timeout
mariadb.service start-pre operation timed out. Terminating.
When mariadb.service fails or hangs, the journal and the server's own start-up messages say why.
3 causes, each with a fixDatabases
MariaDB will not start after a move: Can't create test file ... lower-test
[ERROR] Aborting
The server writes a small test file in its data directory at startup.
4 causes, each with a fixDatabases
Installing the Airflow MySQL provider fails on pkg-config or mysqlclient
Building the mysqlclient wheel fails during the install
The Airflow MySQL provider depends on mysqlclient, which pip compiles against the MySQL C client library.
2 causes, each with a fixDatabases
Compiling a C or C++ program that includes mysql.h fails
undefined reference to `mysql_init'
The compiler only finds mysql.h when the MySQL client development files are installed and their folder is on the include path.
3 causes, each with a fixDatabases
An EC2 instance cannot reach its RDS database
Could not open connection to the host, on port <port>: Connect failed
RDS denies all access until a security group allows it.
3 causes, each with a fixDatabases
Locked out of a fresh MariaDB install as root on Mac or Linux
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
A fresh MariaDB root account is not a normal password account.
3 causes, each with a fix