天天看点

systemctl start mysql.service报错问题

pid文件位置问题:

cat /etc/systemd/system/mysql.service

[unit]

description=mysql server

documentation=man:mysqld(8)

documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html

after=network.target

after=syslog.target

[install]

wantedby=multi-user.target

alias=mysql.service

[service]

user=mysql

group=mysql

type=forking

pidfile=/var/lib/mysql/devops-mysql-slave-150.pid   //修改为正确的mysql pid位置

# disable service start and stop timeout logic of systemd for mysqld service.

timeoutsec=0

# execute pre and post scripts as root

permissionsstartonly=true

# needed to create system tables

execstartpre=/usr/bin/mysqld_pre_systemd

# start main service

execstart=/usr/sbin/mysqld --daemonize --pid-file=/var/lib/mysql/devops-mysql-slave-150.pid $mysqld_opts    ## 修改pid位置

# use this to switch malloc implementation

environmentfile=-/etc/sysconfig/mysql

# sets open_files_limit

limitnofile = 5000

restart=on-failure

restartpreventexitstatus=1

privatetmp=false

启动 :

systemctl start mysql.service

如果嫌mysql.service 麻烦  ,可以修改alias=mysql.service为mysqld

systemctl start mysqld

继续阅读