主页 > InnoDB存储引擎 > 生产中使用哪种MySQL启动关闭方式

生产中使用哪种MySQL启动关闭方式

小牛教程 InnoDB存储引擎 2021年06月16日

service

配置service启动:

。vim /usr/local/mysql/support-files/mysql.server

datadir=/data/mysql/mysql3306/data

。cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld3306

启动命令:service mysqld3306 start

关闭命令:service mysqld3306 stop

mysqld_safe

启动命令:mysqld_safe --defaults-file=/data/mysql/mysql3306/my3306.cnf &

关闭命令:mysqladmin -S /data/mysql/mysql3306/mysql.sock shutdown

mysqladmin -u -p -P -h shutdown

mysqld(推荐)

启动命令:mysqld --defaults-file=/data/mysql/mysql3306/my3306.cnf &

关闭命令:mysqladmin -S /data/mysql/mysql3306/mysql.sock shutdown

systemctl

启动命令:systemctl start mysqld3306.service

关闭命令:systemctl stop mysqld3306.service

配置systemctl启动方式:
vim /etc/systemd/system/mysqld3306.service
[Unit]
Description=MySQL Server by
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
[Service]
User=mysql
Group=mysql
ExecStart=/usr/local/mysql/bin/mysqld --defaults-file=/data/mysql/mysql3306/my3306.cnf
LimitNOFILE = 5000

 

vim /etc/systemd/system/mysqld3307.service

[Unit]
Description=MySQL Server by
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
[Service]
User=mysql
Group=mysql
ExecStart=/usr/local/mysql/bin/mysqld --defaults-file=/data/mysql/mysql3307/my3307.cnf
LimitNOFILE = 5000

广告位
标签: 启动mysql