Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Databases and Redis

Job for mariadb.service failed: how to find the real reason

ErrorFailed 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.

  • Applies to MariaDB 10.11, MariaDB 11.4, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 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 -1
  2. 2Match what you see, then jump to its fix

    1. 1mariadbd: unknown variable 'option=value'A config file has an unknown optionFix
    2. 2Can't lock aria control file '/var/lib/mysql/aria_log_control' for exclusive use, error: 11Another mariadbd already uses the data directoryFix
    3. 3InnoDB: Fatal error: cannot allocate memory for the buffer poolThe InnoDB buffer pool is bigger than the available memoryFix

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-defaults

2Fix

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/null

3Verify

Start the service.

sudo systemctl start mariadb

Confirmed by mariadb.com

Did this fix it?

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 grep

2Fix

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 mariadb

3Verify

Only one server process is left and the unit is active.

systemctl is-active mariadb

Confirmed by mariadb.com

Did this fix it?

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_pool

2Fix

Add memory or lower innodb_buffer_pool_size in the config file.

[mysqld]
innodb_buffer_pool_size=512M

3Verify

Start the service.

sudo systemctl start mariadb

Confirmed by mariadb.com

Did this fix it?

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:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.