a stop job is running for MySQL server

The following error stalls shutdown after the machine goes to sleep mode

a stop job is running for MySQL server

Maybe the time daemon changes and MariaDB cannot restart with the correct time.

My system is always updated.

Shutdown needs to wait until all processes finish all they need to do. mySQL must have some job running or needs to commit some cache

That’s not the problem.
When I don’t put my pc in sleep mode everything is going fine, but when I use sleep mode the problem arose.

Sounds like the machine is going into “sleep mode” while the MySQL stop process hasn’t completed.

This is probably happening because your sleep command is before, or causing the MySQL stop command.
You should be able to address this manually by run the following at least 2 minutes before you intend to put your machine is shutdown or sleep mode

systemctl stop mysqld

Something like the above should be implemented to happen automatically for a “sleep” command but

  • system shutdown and sleep commands are often executed by a Desktop and not using systemd commands, so it’s anyone’s guess what the Desktop developers decide to do
  • Most people won’t want to wait up to 2 minutes for the mysql daemon to shut down properly. If you as a most knowledgeable User knows how to avoid all database activity before shutting down, the above command to stop the mysql daemon will take only a few seconds to complete.
  • It’s a reason why relatively few User apps use database engines like mariadb/mysql.

TSU

If MariaDB is in use the service is ‘mariadb.service’, or its alias ‘mysql.service’ (as defined in /usr/lib/systemd/system/mariadb.service).

Yup,
Careless me, relying on a faulty memory.

TSU

Thanks

I knew that and I did stopped mysql before going to sleep (mode) but I thought that it was some kind of fault that would be fixed.