How To Start, Stop, Restart And Check The Status Of Apache And MySQL On Centos

In this tutorial we will cover how to start, stop, and restart Apache and MySQL on CentOS. Since CentOS is used mostly for a server we will do these steps all at the command line (terminal). We will also use another command to check the status of the services to make sure they are really up or down. Let's get started!





How to Start Apache

/etc/init.d/httpd start



CentOS command Start Apache Web Server - /etc/init.d/httpd start



How to Stop Apache

/etc/init.d/httpd stop



CentOS - Command to Stop Apache Web Server /etc/init.d/httpd stop



How to Restart Apache

/etc/init.d/httpd restart



CentOS command restart Apache Web Server /etc/init.d/httpd restart



How to View Apache Status

(Tell if it is running)

/etc/init.d/httpd status

(Example of Apache being stopped)


Centos - View Apache Status - Stopped example - /etc/init.d/httpd status



(Example of Apache Running)



CentOS command to view apache web server status - Example Running - /etc/init.d/httpd status







How to Start MySQL

/etc/init.d/mysqld start



CentOS command Start MySQL server - /etc/init.d/mysqld start



How to Stop MySQL

/etc/init.d/mysqld stop



CentOS command  - Stop MySQL server - /etc/init.d/mysqld stop




How to Restart MySQL

/etc/init.d/mysqld restart



CentOS Command to Restart MySQL -  /etc/init.d/mysqld restart



How to View MySQL Status

(Tell if it is running)

/etc/init.d/mysqld status


(Example of MySQL Server Running)



CentoS - View MySQL Server Status - /etc/init.d/mysqld status | Example: Running



(Example of MySQL stopped)



CentOS Command to View MySQL server status - /etc/init.d/mysqld status



Hope you found this helpful!