大网数据广告活动
服务器运维问答

Where is systemd script for mysql.service located?

· 52CE 我爱测

I am actually using MariaDB (drop-in replacement for MySQL). I'm trying to make some changes to my systemd mysql.service file. I can see it exists because running sudo systemctl lists it and indicates that it is loaded / active /…

问题原文

原帖链接 · David Mackey · CC BY-SA 3.0

I am actually using MariaDB (drop-in replacement for MySQL).

I'm trying to make some changes to my systemd mysql.service file.

I can see it exists because running sudo systemctl lists it and indicates that it is loaded / active / running.

The issue is that I can't find the file to make edits. From what I've read in various articles I've found is that the doc should be located at

/etc/systemd/system/multi-user.target.wants/mysql.service

But it isn't. I've browsed through other directories at the /etc/systemd level to no avail. Any ideas?

社区高分解答

原帖链接 · Adrian Antunez · CC BY-SA 3.0

For units defined in static files you could use systemctl status, with the information outputed issuing that command, you will be able to see its location.

For example:

# systemctl  status sshd
● sshd.service - OpenSSH Daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2016-10-31 17:01:01 UTC; 1 weeks 0 days ago
 Main PID: 283 (sshd)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/sshd.service
           └─290 /usr/bin/sshd -D

Note that the tab command could be helpful here.

Therefore, in my system the systemd services are placed under /usr/lib/systemd/. Please, note that there could be folders in that location.

Another way is to use the find command in that specific location to find a service:

# find /usr/lib/systemd/ | grep -i mysql

I hope that helps ;)

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2015-12-04)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。