Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Databases and Redis

mysqld.service refuses to start: start request repeated too quickly

Errormysqld.service: Start request repeated too quickly.

Short answer

This message only says systemd gave up after several failed starts. The cause is in the lines before it. Read the unit journal and the MySQL error log, fix what they name (usually an uninitialised or wrongly owned data directory, or an unwritable log), then clear the counter with systemctl reset-failed and start again.

  • Applies to MySQL 8.4, systemd 255, Ubuntu 24.04, Arch-based Linux
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Read the newest journal lines for the unit. The first failure, above the start-limit line, is the real error. Use the unit name your system has: mysqld on RPM and Arch-style systems, mysql on Debian and Ubuntu.

    sudo journalctl -u mysqld -b -n 80
  2. 2Match what you see, then jump to its fix

    1. 1The log shows the server stopping straight after start, and /var/lib/mysql is empty or has no mysql schemaThe data directory was never initialisedFix
    2. 2Permission denied lines for files under the data directory, usually after a restore or copy done as rootThe data directory belongs to the wrong userFix
    3. 3The log-error path is outside /var/log/mysql*.log (RPM) or /var/log/mysql/*.log (Debian) and the service fails at onceThe error log file cannot be created or writtenFix

What does the error look like?

  • mysqld.service: Start request repeated too quickly.
  • systemctl status mysqld shows the unit as failed
  • systemctl start mysqld fails again straight away

Cause 1 of 3

The data directory was never initialised

1Check

Some packages do not create the data directory contents on install. The MySQL manual says the data directory is created by running mysqld with --initialize, and that on RPM platforms an empty data directory is initialised at startup by the service.

sudo ls -la /var/lib/mysql | head

2Fix

With the service stopped, initialise the directory as the mysql user. Note the generated root password in the output. The command aborts if the directory is not empty, so move any broken contents aside first (keep them until you are sure there is nothing to recover).

sudo mysqld --initialize --user=mysql

3Verify

Clear the start limit and start the service.

sudo systemctl reset-failed mysqld
sudo systemctl start mysqld
systemctl status mysqld --no-pager

Confirmed by dev.mysql.com

Did this fix it?

Cause 2 of 3

The data directory belongs to the wrong user

1Check

The manual says the database directories and files must be owned by the mysql login account so the server can read and write them later.

sudo ls -ld /var/lib/mysql && sudo find /var/lib/mysql ! -user mysql | head

2Fix

Give the tree back to the mysql user. If you moved the data directory, make sure the datadir option points at the new place and AppArmor on Debian-based systems allows it.

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

3Verify

Clear the counter and start again.

sudo systemctl reset-failed mysqld
sudo systemctl start mysqld

Confirmed by dev.mysql.com

Did this fix it?

Cause 3 of 3

The error log file cannot be created or written

1Check

The startup helper only creates the error log itself for those default patterns. For any other path the file must already exist and be writable by the user running mysqld.

sudo grep -R "log-error" /etc/my.cnf /etc/my.cnf.d /etc/mysql 2>/dev/null

2Fix

Create the file and give it to the mysql user, or point log-error back to a default location.

sudo touch /var/log/mysqld-custom.log
sudo chown mysql:mysql /var/log/mysqld-custom.log

3Verify

Start the service.

sudo systemctl start mysqld && systemctl is-active mysqld

Confirmed by dev.mysql.com

Did this fix it?

How do I stop it coming back?

  • Run systemctl status and journalctl after every config change, before restarting more than once.
  • Keep the data directory and any custom log files owned by the mysql user.
  • Remember that every start counts toward the systemd limit, including manual ones; stop retrying and read the log after the first failure.

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.