linux mysql设置system启动并添加环境变量

添加system启动

cat <<EOF> /usr/lib/systemd/system/mysqld.service 
[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=https://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=/etc/my.cnf
LimitNOFILE = 5000
EOF

测试命令

systemctl daemon-reload
systemctl status mysqld.service

添加环境变量

echo 'PATH=/usr/local/mysql/bin/:$PATH' >/etc/profile.d/mysql.sh
source /etc/profile.d/mysql.sh
posted @ 2021-01-20 14:17  名字长的像一只老山羊  阅读(580)  评论(0编辑  收藏  举报