Configure MySQL boot start on CentOS 7
Several times before in the CENTOS7 environment configuration MySQL boot error, leaving a post has been recorded
What is the difference between Centos7 and CENTOS6 :
1 service in Centos7 is not to start and stop with service This command, also no longer use Chkconfig to set boot or not!
In Centos7 all the management of the service is concentrated in the Systemctl; Systemctl is no longer dependent on/etc/init.d/
Script, it is through the configuration file to complete the management of the service;
Second, create the SYSTEMCTL management MySQL configuration file :
1 Creating a configuration file
Touch/usr/lib/systemd/system/mysql.service
Systemctl the suffix name of the configuration file, the suffix name of this file should end with. Service, of course, because it can omit the suffix by default, you can also not specify the suffix name.
Do not ask me why this deliberately pointed out that I have been engaged in two days because the service was written to the server, so has not been successful;
examples of configuration files :
1 Currently the configuration file on my machine is as follows
[Unit] Description=mysql Serverdocumentation=man:mysqld (8) documentation=http://dev.mysql.com/doc/refman/en/ Using-systemd.htmlafter=network.targetafter=syslog.target[install]wantedby=multi-user.target[service]user= Mysqlgroup=mysqlexecstart=/usr/local/mysql/bin/mysqld--defaults-file=/etc/my.cnflimitnofile = 5000#Restart= On-failure#restartpreventexitstatus=1#privatetmp=false
In the Systemctl configuration file, the # number is used to denote comments, and the most important line here is Execstart, which represents the command to execute when Systemctl starts MySQL.
Just replace this sentence on your system.
iv. start MySQL with systemctl:
[[email protected] system]# systemctl start mysql[[email protected] system]# Ps-ef | grep mysqlmysql 9171 1 4 17:08? 00:00:00/usr/local/mysql/bin/mysqld--defaults-file=/etc/my.cnfroot 9205 8508 0 17:08 pts/0 00:00:00 grep--color=auto MySQL
v. To set up MySQL boot by systemctl :
Configure MySQL boot start on CentOS 7