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 or 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 OR 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 OR 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 or sudo service mysql stop or 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 or sudo service mysql start or 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 or sudo service mysql restart or sudo /etc/init.d/mysql restart
Other Useful resources
- How to Install WAMP server for windows 10
- Install Apache web server on CentOS 7/6 with a single command
- How to install phpMyAdmin on Centos 7 & Centos 6
Related Posts
Install Apache, PHP & MYSQL on Windows 11 | 10 using CMD
How to create a Mysql Database on Amazon LightSail
How to install XAMPP on Windows 10 using Command prompt
Install Apache Tomcat on Windows 10 using Command prompt
How to install Apache Server on Windows using Chocolatey command line
Steps to Install Apache, MySQL and PHP in WSL 2 -Windows 10