Configure MySQL boot start on CentOS 7

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.