Use Systemd to manage MySQL 7.1 compiled and installed on CentOS 5.6
CentOS 7.1 does not use MySQL 5.6 by default. The robust method is to compile and install the source code provided on the MySQL official website. However, the startup management of MySQL 5.6 compiled and installed is based on the service management method of CentOS 6. x, rather than the Systemd management method of CentOS 7. x. MySQL provides the yum source for MySQL 5.6 provided by RHEL and CentOS. MySQL installed using yum comes with Systemd to manage script files.
So, how to use Systemd to manage the MySQL compiled and installed?
First, check the Systemd management script provided by MySQL installed in yum.
$ Cat/usr/lib/systemd/system/mysqld. service
#
# Simple MySQL systemd service file
#
# Define EMD 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)
# Will be overwritten on package upgrade, please copy the file
#
#/Etc/systemd/system/mysql. service
#
# To make needed changes.
#
# Systemd-delta can be used to check differences between the two mysql. service files.
#
[Unit]
Description = MySQL Community Server
Afterdomainnetwork.tar get
After1_syslog.tar get
[Install]
Wantedbypolicmulti-user.tar get
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 =/usr/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 an answer
TimeoutSec = 600
Restart = always
PrivateTmp = false
It should look like this at last
#
# Simple MySQL systemd service file
#
# Define EMD 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)
# Will be overwritten on package upgrade, please copy the file
#
#/Etc/systemd/system/mysql. service
#
# To make needed changes.
#
# Systemd-delta can be used to check differences between the two mysql. service files.
#
[Unit]
Description = MySQL Community Server
Afterdomainnetwork.tar get
After1_syslog.tar get
[Install]
Wantedbypolicmulti-user.tar get
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 =/usr/local/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 an answer
TimeoutSec = 600
Restart = always
PrivateTmp = false
-------------------------------------- Split line --------------------------------------
Install MySQL in Ubuntu 14.04
MySQL authoritative guide (original book version 2nd) Clear Chinese scan PDF
Ubuntu 14.04 LTS install LNMP Nginx \ PHP5 (PHP-FPM) \ MySQL
Build a MySQL Master/Slave server in Ubuntu 14.04
Build a highly available distributed MySQL cluster using Ubuntu 12.04 LTS
Install MySQL5.6 and Python-MySQLdb in the source code of Ubuntu 12.04
MySQL-5.5.38 universal binary Installation
-------------------------------------- Split line --------------------------------------