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

- Advertisment -
- Advertisement -

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

73% of software developers willing to invest Rs 10-20k per year for upskilling

The rapid development in the technology area is compelling the firms and developers to gear up their technology skills...

Sony accidentally confirmed a massive News leak on PS5

The PlayStation 5 launch is just around the corner. Also, the rumours are about an upcoming meeting of Sony...

Horizon: Zero Dawn is Coming to PC, all about its release

There is news coming up from the insider sources that Sony is already working on their project to release...

WhatsApp Dark Mode is available for Android users, test it now!

Finally, to save the oil of eye lamps especially for those continuously do chats on WhatsApp, Dark Mode is...
- Advertisement -

VMate successfully secured a place in top 5 Social Media App Category

Recently, a report has been published by App Annie to know what is the "State of mobile 2020". The...

AI in education sector: making a future-ready workforce

As we are approaching towards ending another decade, it’s time to reflect the future. FUTURE-READINESS OF SCHOOL ECOSYSTEM. As...

- Advertisment -
- Advertisement -

You might also likeRELATED
Recommended to you