centos7 systemctl 管理 mysql

centos 7 开始使用systemctl 管理服务

服务脚本目录 /etc/systemd/system/mysql.service

脚本如下:

#

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

# will be overwritten on package upgrade, please copy the file to

#

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

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 an 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 only if the log location matches a pattern (/var/log/mysql*.log for RPM platforms, /var/log/mysql/*.log for Debian platforms). In other cases, the error log directory must be writable or the error log must be present and writable for the user running the mysqld process.

如果 mysql error log 设置在 /var/log 下

以下是percona mysql 设置

[[email protected] system]# cat mysqld.service

#

# Systemd service file for Percona Server

#

# # This service file is 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 an answer

TimeoutSec=600

Restart=always

PrivateTmp=false

[[email protected] system]# pw

时间: 2024-12-16 10:54:23

centos7 systemctl 管理 mysql的相关文章

CentOS7.5下开发systemctl管理的自定义Rsync启动服务程序

CentOS7.5下开发systemctl管理的自定义Rsync启动服务程序 1.1 systemctl知识简介 从CentOS7 Linux开始,系统里的网络服务启动已经从传统的service改成了systemctl(一个systemd工具,主要负责控制systemd系统和服务管理器.),管理开机自启动的命令也从chkconfig改为了systemctl,由systemctl一个命令代替了CentOS7以前系统中的service和chkconfig两个命令. 系统服务的脚本也从传统的路径的/e

CentOS7 下面安装Mysql MMM

参考文档  参考1 参考2 二. 安装操作系统 最小化安装CentOS7(64位) 三. 配置操作系统 1.关闭 selinux cat /etc/selinux/config SELINUX=disabled 2.关闭防火墙 systemctl stop firewalld systemctl disable firewalld 3.配置NTP ,同步时间 yum -y install ntp vi /etc/ntp.conf 增加3个时间服务器 server s2d.time.edu.cn

CentOS7下安装MySQL并配置远程连接

一.CentOS7下安装MySQL数据库 CentOS7默认的安装包里面已经没有 MySQL-Server安装包了,远程镜像中也没有了. 默认的是MariaDB (MySQL的一个分支,开发这个分支的原因之一是:甲骨文公司收购了MySQL后,有将MySQL闭源的潜在风险,因此社区采用分支的方式来避开这个风险 参照百度.开发基本相似). 参考文章:CentOS7 安装MySQL http://www.centoscn.com/mysql/2016/0315/6844.html 这里主要是安装MyS

CentOS7上安装MySQL总结

一.MySQL数据库介绍 1.数据库基础知识 MySQL是一种开放源代码的关系型数据库管理系统(RDBMS),MySQL数据库系统使用最常用的数据库管理语言–结构化查询语言(SQL)进行数据库管理. MySQL在2008年被SUN公司收购,2009年SUN公司被Oracle公司收购. MySQL5.6功能变化较大,MySQL5.7性能上有很大提升 Mariadb为MySQL的一个分支,官方网站:https://mariadb.com, MariaDB主要由SkySQL公司维护,而SkySQL公司

五·管理mysql

在上一篇文章中 四·安装mysql-5.7.16-linux-glibc2.5-x86_64.tar.gz(基于Centos7源码安装) 已经安装好了mysql,也正常启动了.本篇文章主要内容是管理mysql 1.服务器端登录mysql 使用./mysqld --user=mysql的方式虽然可以启动服务器,但是在登录mysql的时候却出现了问题" ERROR 1045 (28000): Access denied for user 'mysql'@'localhost' (using pass

centos7 systemctl grub2

centos最小好化安装没有ifconfig命令 刚安装了centos7.0,最小化安装,发现没有ifconfig命令,虚拟机里面的网卡显示ens32,这是centos7.0的特点,要使用 ifconfig命令,在/etc/sysconfig/network-scripts/if-ens32里面配置好网络,记住onboot=on这个选项一定要设置,不然网络启动不了,重启网络,/etc/init.d/network restart 使用centos的官方yum源 yum clean all yum

在Centos7玩转Mysql半同步和keepalived+MHA(二)

在上一篇完成了Mysql的半同步配置. 链接:在Centos7玩转Mysql半同步和keepalived+MHA(一),本篇则继续完成MHA+keepalived的配置. 角色 IP OS MySQL MHA mha-manager 192.168.1.92 CentOS 7 无 mha-manager mha-node mysql-master 192.168.1.151 CentOS 7 mysql-master mha-node mysql-slave01 192.168.1.152 Ce

centOS7服务管理与启动流程

centOS7服务管理与启动流程 centOS7启动流程 systemd简介 unit对象 unit类型 特性 service unit文件格式 service unit file文件通常由三部分组成 unit段的常用选项 Service段的常用选项 Install段的常用选项 管理服务 管理系统服务 服务查看 chkconfig命令的对应关系 其他命令 服务状态 systemctl示例 运行级别 运行级别与target的对照 运行级别的切换 CentOS7引导顺序 设置简单的内核参数 简单的启

CentOS7 下安装 mysql 涉及到的命令

VMware虚拟机装好后,再装个CentOS7系统,以上环境自行百度... 一.Linux下查看mysql是否安装 1.指令ps -ef|grep mysql [[email protected]st 桌面]# ps -ef|grep mysql mysql 2688 1 0 13:31 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe --basedir=/usr mysql 2857 2688 0 13:31 ? 00:00:01 /usr/sbin/mysql