How to start, restart & stop Apache & MySQL server on Ubuntu

- Advertisment -

This tutorial is all about the commands you need to know how do you start/restart an Apache 2 Web Server and MySQL server on Ubuntu or Debian Linux operating system.

The Apache web server is the light and most popular open source web server use worldwide on Linux based operating system. It can be installed on Ubuntu with a single command to handle both dynamic and static content web pages. Most of the WordPress and other popular CMS uses it as a Web server.

Furthermore, when you want to create some online application or website then you also need a database software to store all your content and here the MySQL comes in. It is also an open source database system software that can install on any Linux operating system with ease. If you are new to both then you can look at our tutorial which let you know how to install Apache, MySQL, and PHP on Ubuntu Linux.

The below-given commands will work on all Ubuntu and Debian based Linux operating systems no matter where they are, it could be on your local PC system or a hosting or cloud services like AWS, DigitalOcean, google cloud and more..

Start Apache on Ubuntu Linux

The command to start the Apache web server on Ubuntu is:

sudo /etc/init.d/apache2 start


sudo service apache2 start

Stop Apache server on Ubuntu Linux

Command on the terminal to stop the web server Apache2

sudo /etc/init.d/apache2 stop


sudo service apache2 stop

Restart Apache server on Ubuntu Linux

Commands to execute on Ubuntu terminal to restart the Apache web server.

sudo /etc/init.d/apache2 restart


sudo service apache2 restart

If you are using the Ubuntu 15.04 or above then you can also use the below commands to start/restart and stop the Apache web server.

To start Apache
systemctl start apache2.service

To stop Apache
systemctl stop apache2.service

To Restart Apache
systemctl restart apache2.service

For start/Stop and restart the MySQL server on Ubuntu use the below mentioned commands:

Stop MySQL on Ubuntu Linux

Terminal commands to stop MySQL

sudo stop mysql


sudo service mysql stop


sudo /etc/inid.d/mysql stop


Start MySQL on Ubuntu Linux

Use any of one given below to start the MySQL, if it in a stop state.

sudo start mysql


sudo service mysql start


sudo /etc/init.d/mysql start

Restart MySQL on Ubuntu Linux

To restart the MySQL Ubuntu Linux server use the commands in terminal.

sudo restart mysql


sudo service mysql restart


sudo /etc/init.d/mysql restart

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

What is the seamless mode on VirtualBox? How to control host and VM using it

If you are looking for an open-source virtual Machine manager, VirtualBox is one of the best options that you...

What is GitHub? Why programmers use GitHub?

For the upcoming software developers and the existing riders, it is always hard to manage and select the right...

How to use the Save to Facebook extension to bookmark web links on Facebook

We come across different types of links while we access the internet and one of the best ways to...

Top 5 free CRM Services for New and Small Businesses

Starting a new business or a startup can be hard as climbing a mountain with a...
- Advertisement -

MagTapp app – Improve your vocabulary on Android while browsing web

Improve your English vocabulary and word meanings right on the web browser while ready different articles using...

Best 5 Free Apps to Create Bootable USB drives in 2020

Do you need to install an operating system in your Computer? Then quickly grab a CD or DVD and...
- Advertisement -

You might also likeRELATED
Recommended to you