Auto Starting MySQL, HTTPD after reboot?

How do I ensure MySQL and HTTPD are started automatically after a server reboot?

I am using CentOS, Apache, PHP, MySQL

5 Replies

Plenty of material on this subject, such as

http://www.techiecorner.com/104/how-to- … ime-linux/">http://www.techiecorner.com/104/how-to-auto-start-apache-during-boot-time-linux/

Google is your friend.

But the gist of it is scripts in /etc/init.d, which sort of acts like the startup folder for 'doze. Anything in that folder will at least attempt to run at startup.

You'll probably have one script called httpd, and another mysql. The install may or may not have placed them there automagically.

HTH

Hi Sagar,

Go to /etc/rc.d/rc3.d directory and perform an ls command.

You will get a listing of files. The files with a K prefix do not start up automatically at boot. The files that are prefixed with an S will start up automatically at boot.

If you want to start up Mysql and Http at boot:

perform the following commands as root:

mv K15httpd S15httpd

mv K36mysqld S36mysqld

That assumes that httpd and mysqld are not already enabled for start up. Just verify the K or S prefix and the sequence number for your instance.

In other words, the prefix for services that you want to start at boot should be prefixed with an S and the ones that you do not want to start at boot should be prefixed with a K.

This works for me, YMMV

Jeff

Thanks for the replies guys thats indeed helpful :)

/etc/iinit.d in CentOS is merely a collection of scripts to manually start, stop, and restart services. They are not started by default at boot. That is the purpose of the rc.d directories.

Jeff

Also have a look at chkconfig (man chkconfig).

e.g., to see all services set to run in runlevel 3:

[root@server:~] chkconfig –list | grep 3:on

To set apache to run in the default runlevels:

[root@server:~] chkconfig httpd on

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct