linux下将apache和mysql加入系统服务

时间:2023-02-15 16:11:15

Apache:

    cp /usr/sbin/apachectl /etc/rc.d/init.d/httpd 增加httpd服务

    vi /etc/rc.d/init.d/httpd

    在第2行加入
    # chkconfig: - 85 15
    # description: Apache is a World Wide Web server. It is used to serve

    # HTML files and CGI.

    然后执行

    chkconfig –add httpd

如此可以使用service httpd start来启动apache了

Mysql:

    cd /usr/local/mysql/share/mysql
    cp mysql.server /etc/init.d/mysqld
    chkconfig --add mysqld
    chkconfig mysqld on

    service mysqld restart

如此可以使用service mysqld start来启动mysql了


另外一种办法:

https://blog.csdn.net/detiantian/article/details/52187902