Operations 6 min read

How to Configure MySQL 8.0 as a Systemd Notify Service on Linux

This guide walks through verifying MySQL 8.0.16+, copying and editing the mysqld.service file, setting the Service Type to notify, adding NotifyAccess, adjusting ExecStart, reloading systemd, restarting MySQL, and checking its status, while covering SELinux, firewall, and notification‑delay optimizations.

Ops Development & AI Practice
Ops Development & AI Practice
Ops Development & AI Practice
How to Configure MySQL 8.0 as a Systemd Notify Service on Linux

Introduction

Systemd is the modern init system for most Linux distributions, providing process management, automatic service start, and dependency handling. MySQL 8.0.16 and later can integrate natively with systemd using the notify service type, which improves status reporting and reliability.

Step 1: Verify MySQL Version

Ensure the installed MySQL version is 8.0.16 or newer, as only these versions support the notify type.

mysql --version

Step 2: Copy and Edit the Service File

To avoid modifying the original system file, copy the default MySQL service unit to /etc/systemd/system/ and edit it with a text editor.

sudo cp /usr/lib/systemd/system/mysqld.service /etc/systemd/system/
sudo vim /etc/systemd/system/mysqld.service

Step 3: Modify the Service Type to notify

In the [Service] section, make the following changes:

Set Type to notify to enable systemd notifications.

[Service]
Type=notify

Add NotifyAccess=all to allow MySQL to send status updates to systemd. NotifyAccess=all Ensure ExecStart points to the MySQL executable mysqld . ExecStart=/usr/sbin/mysqld Make sure the path is correct and remove any reference to mysqld_safe, which does not support systemd notifications.

Step 4: Reload Systemd Configuration

After saving the modified unit file, reload the systemd manager to apply the changes.

sudo systemctl daemon-reload

Step 5: Start or Restart MySQL Service

Restart the MySQL service so that it runs with the new systemd configuration. sudo systemctl restart mysqld The service should now send notifications using the notify mechanism.

Step 6: Verify MySQL Service Status

Check the service status to confirm it is active and using the notify type. sudo systemctl status mysqld The output should show active (running), indicating a successful start.

Additional Considerations

SELinux Settings : If SELinux is enforcing, adjust policies (e.g., with audit2allow ) to permit mysqld to send notifications.

Firewall Settings : Ensure the firewall does not block MySQL’s port (default 3306). Use firewall-cmd to allow the required ports.

Optimizing Notification Latency : Fine‑tune MySQL configuration parameters to reduce startup time and improve reliability of the notify mechanism.

Conclusion

Integrating MySQL 8.0 with systemd’s notify mechanism provides finer‑grained service management and monitoring, enhancing system stability and enabling faster fault detection and recovery.

MySQL Systemd diagram
MySQL Systemd diagram
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxmysqlNotify
Ops Development & AI Practice
Written by

Ops Development & AI Practice

DevSecOps engineer sharing experiences and insights on AI, Web3, and Claude code development. Aims to help solve technical challenges, improve development efficiency, and grow through community interaction. Feel free to comment and discuss.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.