Use Systemd to manage MySQL 7.1 compiled and installed on CentOS 5.6

Source: Internet
Author: User

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 --------------------------------------

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.