linux将mysql加到systemctl命令中

linux中,想将mysql加到systemctl命令中,首先需要确定mysql的安装位置

在/etc/systemd/system目录下新建mysql.service

vim /etc/systemd/system/mysql.service

复制如下内容:确保你自己的mysql路径是否正确

复制代码
[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target

[Install]
WantedBy=multi-user.target

[Service]
User=mysql
Group=mysql
ExecStart=/usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf
LimitNOFILE = 5000

重新加载服务

systemctl daemon-reload

如此,就可以用systemctl进行管理了。
首次运行,要先关闭手动启动的mysql,然后用systemctl启动,之后就可以用systemctl进行重启和关闭了;

相关推荐
小猿姐6 小时前
唯品会大规模数据库云原生实践:基于 KubeBlocks 管理数千实例的统一运维之路
运维·elasticsearch·云原生
七歌杜金房11 小时前
我终于又有了自己的 Linux 电脑
linux·debian·mac
SkyWalking中文站18 小时前
认识 Horizon UI · 5/17:3D 基础设施地图
运维·监控·自动化运维
tntxia1 天前
linux curl命令详解_curl详解
linux
扛枪的书生2 天前
Linux 网络管理器用法速查
linux
SkyWalking中文站2 天前
认识 Horizon UI · 1/17:SkyWalking 新一代可观测性控制台
运维·前端·监控
顺风尿一寸2 天前
Java Socket 内核之旅:从 SocketChannel.read() 到 tcp_recvmsg 与 epoll 的完整调用链路
linux
雪梨酱QAQ2 天前
Kubeneters HA Cluster部署
运维
江华森2 天前
Spring Cloud 微服务全栈实战:从 Eureka 到 Docker Compose 一文贯通
运维
江华森2 天前
Matplotlib 数据绘图基础入门
运维