添加system启动
[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