How to restart Apache and MySQL in CentOS/RHEL/Fedora/Scientific Linux version

- Advertisment -

Intermittently we require to start, restart or stop the Apache web server or MYSQL server on CentOS. The CentOS/Red Hat is the most popular Linux OS used commercially as a server operating system in enterprises, cloud and hosting environments.

Here in this tutorial will let you know the commands those you can use in the CentOS terminal to Stop/start or restart the MySQL or Apache on CentOS.

Below given commands are meant to work specifically on CentOS /RHEL (Red Hat)/Fedora based Linux version 4.x/5.x/6.x or older.

Command to Start Apache in CentOS 

service httpd start

Stop Apache command 

service httpd stop

Command to Restart

service httpd restart

Now commands for the latest version CentOS 7.x /RHEL (Red Hat)

To start the Apacher server

systemctl start httpd.service

Stop command for Apache in CentOS 7

systemctl stop httpd.service

Restart command for Apache

systemctl restart httpd.service


How to Start/Stop or Restart the MySQL server in CentOS/RHEL/Fedora/Scientific Linux version

Commands to start or stop the MySQL or MariaDB server in Centos 4.x, 5.x, 6.x or older versions

To Start MySQL in CetnOS uses the below commands:

sudo service mysqld start 


sudo /etc/init.d/mysqld start

Commands to stop the MySQL server

sudo service mysqld stop 


sudo /etc/init.d/mysqld stop

To restart the MYSQL server

sudo service mysqld restart 


sudo /etc/init.d/mysqld restart

For the latest CentOS 7.x version use the below commands

The latest CentOS 7.x by default comes with MariaDB packages but the user can install the MySQL too. Here are the commands for both:

To start MariaDB

systemctl start mariadb

For MySQL the command will be:

systemctl start mysqld

To stop the MySQL or MariaDB the command will be: 

For MariaDB: 

systemctl stop mariadb

For MySQL: 

systemctl stop mysqld

In order to restart the Database serve MariaDB or MySQL follow the below:


 systemctl restart mysqld

For MariaDB

systemctl restart mariadb

Other Useful Resources


Rajkumar Maurya
Rajkumar Maurya is the H2S Media tech expert. He’s always been passionate about technology and has been writing on the subject since 2014. He has extensive knowledge of all kinds of technology, from consumer-tech to enterprise solutions. You can contact the author at--


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Latest Posts

How to take notes using Telegram or Telegram X & access on all devices

When it comes to cross-platform messaging WhatsApp should be the first one that comes to your mind, but Telegram...

9 Best Weather App for Android in 2020 (free)

I still keep in mind the times when we had to browse the newspapers to understand the weather reports and forecasts or sit ahead of a TV to...

Top 5 SSL Certificate Providers 2019-2020

In any kind of business or for any other reason when you open a website, you must...

Fortnite adds a split-screen feature on Consoles and Star Wars mode

The latest update of Fortnite is here. And it brings a brand new feature which is very...
- Advertisement -

Xbox Scarlett is now officially Xbox Series X

Ending every speculation and rumours, Microsoft named the next-gen console as Xbox Series X. Taking the opportunity of The...

What points one should look to get the best internet connection for gaming

Finding the right gaming computer of your choice might not be a difficult exercise today when you...
- Advertisement -

You might also likeRELATED
Recommended to you