DB/mysql

[Linux] Mysql Service 등록

고지식한청춘 2020. 6. 11. 17:31
728x90

Mysql 서비스 등록

 

1. Service 파일 생성

$ vi /usr/lib/systemd/system/mysql.service

 

[Unit]

Description=MySQL Community Server

After=network.target

After=syslog.target



[Install]

WantedBy=multi-user.target

Alias=mysql.service



[Service]

User=mysql

Group=mysql





# Start main service

ExecStart=/usr/local/mysql/bin/mysqld_safe --user=mysql



# Give up if ping don't get an answer

TimeoutSec=300

PrivateTmp=false

 

 

2. systemctl daemon 재시작

# systemctl daemon-reload

 

 

◎ 정상적으로 Service가 등록되었는지 확인

$ systemctl status mysql

728x90