If you are installing MySQL through the tar package, it is not automatically added to the system service and can be added by yourself in the following way.
Add Mysql.service to the/usr/lib/systemd/system directory as follows:
[Unit]description=mysqlafter=syslog.target network.target remote-fs.target nss- Lookup.target[service]type=forkingpidfile=/usr/local/mysql/data/xxx. Pidexecstart=/usr/ local/mysql/support-files/mysql.server startexecreload=/bin/kill -s HUP $MAINPIDExecStop =/bin/Kill -s QUIT $MAINPIDPrivateTmp=false[Install]
Reload the unit, scan for new or changed cells, and make the newly added mysql.service effective
Systemctl Daemon-reload
After that, you can use the following command to manipulate MySQL
Systemctl Enable Mysqlsystemctl start mysqlsystemctl stop mysqlsystemctl restart MySQL
The above four commands are:
- Set to boot
- Start
- Stop it
- Restart
Add MySQL as a system service in CentOS7