Centos7 Systemctl managing MySQL

Source: Internet
Author: User
Tags syslog percona percona server

CentOS 7 starts using SYSTEMCTL Management Services


Service Script Directory/etc/systemd/system/mysql.service

The script is as follows:




#

# Simple MySQL systemd service file

#

# SYSTEMD supports lots of fancy features, look here (and linked docs) for a full list:

# http://www.freedesktop.org/software/systemd/man/systemd.exec.html

#

# note:this file (/usr/lib/systemd/system/mysql.service)

# 'll be overwritten in package upgrade, please copy the file to

#

#/etc/systemd/system/mysql.service

#

# to make needed changes.

#

# Systemd-delta can used to check differences between the Mysql.service files.

#


[Unit]

Description=mysql Community Server

After=network.target

After=syslog.target


[Install]

Wantedby=multi-user.target

Alias=mysql.service


[Service]

User=mysql

Group=mysql


# Execute pre and post scripts as root

Permissionsstartonly=true


# Needed to create system tables etc.

#ExecStartPre =/usr/bin/mysql-systemd-start Pre



# Start Main Service

Execstart=/application/mysql/bin/mysqld_safe


# Don ' t signal startup success before a ping works

#ExecStartPost =/usr/bin/mysql-systemd-start Post


# Give up if ping don ' t get a answer

timeoutsec=600


Restart=always

Privatetmp=false


---


mysqld_pre_systemd(RPM platforms),mysql-system-start(Debian platforms): Support script for the unit file. This script assists in creating the error log file is only if the log location matches a pattern (/var/log/mysql*.logfor RPM platforms,/var/log/mysql/*.logFor Debian platforms). In other cases, the error log directory must is writable or the error log must is present and writable for the user Runnin G themysqldprocess.



If MySQL error log is set under/var/log


Here are the Percona MySQL settings


[email protected] system]# cat Mysqld.service

#

# SYSTEMD Service file for Percona Server

#

# # This service file was to start PS just with Mysqld_safe

#


[Unit]

Description=mysql Percona Server

After=network.target

After=syslog.target


[Install]

Wantedby=multi-user.target

Alias=mysql.service


[Service]



# Execute pre and post scripts as root

Permissionsstartonly=true

# Needed to create system tables etc.

EXECSTARTPRE=/USR/BIN/MYSQL-SYSTEMD Pre


# Start Main Service

Execstart=/usr/bin/mysqld_safe


# Don ' t signal startup success before a ping works

Execstartpost=/usr/bin/mysql-systemd Post


# Give up if ping don ' t get a answer

timeoutsec=600


Restart=always

Privatetmp=false


[Email protected] system]# PW




Centos7 Systemctl managing MySQL

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.