niloofar
niloofar

Reputation: 2334

mysqld.service failed because a timeout was exceeded

With this command:

sudo systemctl restart mysqld

I face with this error:

Job for mysqld.service failed because a timeout was exceeded. See "systemctl status mysqld.service" and "journalctl -xe" for details.

How can I solve it?

Upvotes: 3

Views: 10266

Answers (3)

mlazarov
mlazarov

Reputation: 401

Most probably you have huge database that requires a lot of time to start. If that's the case then you can change the service start timeout to something that will work for you. To do that add this line to the service file:

TimeoutSec=1200

or

TimeoutStartSec=1200

If you are using MariaDB then the file is located at this path:

/usr/share/mysql/systemd/mariadb.service

If you are using MySQL then probably the path is:

/usr/share/mysql/systemd/mysqld.service

Upvotes: 2

thatsaru
thatsaru

Reputation: 129

This maybe related to selinux being set to enforcing. Have a look at /etc/selinux/config (on CentOS, location may vary on other distributions). If SELINUX=enforcing, try setting SELINUX=permissive and

  • Reboot the machine
  • Start MySQL if not already (sudo systemctl start mysqld)

In case SELINUX=enforcing is required, have a look at https://www.techrepublic.com/blog/linux-and-open-source/practical-selinux-for-the-beginner-contexts-and-labels/ or other similar posts.

Hope this helps.

Upvotes: 0

Sizwan
Sizwan

Reputation: 15

Reinstalling MySQL might help:

  1. Uninstall the current MySQL
  2. Delete /var/lib/mysql and /etc/mycnf or /etc/mycng.rpmsave
  3. Reboot the machine
  4. Reinstall MySQL

Upvotes: -1

Related Questions