vim /usr/lib/systemd/system/mysql.service
----------
[Unit]
Description=MySQL Server
Documentation=man:mysqld
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target

[Install]
WantedBy=multi-user.target

[Service]
User=mysql
Group=mysql

PIDFile=/data/mysql/pid/mysqld.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/local/mysql/bin/mysqld --daemonize --pid-file=/data/mysql/pid/mysqld.pid
#注意这里要加上 --daemonize
# Use this to switch malloc implementation
#EnvironmentFile=-/etc/sysconfig/mysql
# Sets open_files_limit
LimitNOFILE = 5000
Restart=on-failure
RestartPreventExitStatus=1
PrivateTmp=false
----------
systemctl daemon-reload
#重新载入

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-05-19
  • 2021-07-01
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
  • 2021-07-30
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-12
  • 2022-02-11
  • 2022-02-02
  • 2021-07-26
相关资源
相似解决方案