How To Start, Stop, and Restart Apache and MySQL on Ubuntu

In this tutorial we will cover how to start, stop and restart your Apache web server and MySQL db on Ubuntu. Since most Linux servers do not have a graphical user interface installed we will do the steps in a terminal.

In this tutorial I am working with Ubuntu 11.04 Server. If you are running Apache on your Ubuntu desktop these steps will work for you as well.

 

 

Apache:


 

To Start Apache:

sudo /etc/init.d/apache2 start

 

 

Ubuntu  - Start Apache /etc/init.d/apache2 start

 

 

 

To Stop Apache:

sudo /etc/init.d/apache2 stop

 

 

Ubuntu Stop Apache Web Server sudo /etc/init.d/apache2 stop

 

 

To Restart Apache:

sudo /etc/init.d/apache restart

 

 

Ubuntu - Restart Apache Web Server - sudo /etc/init.d/apache2 retsrat

 

 

 

 

 

 

 

MySQL:


 

To Start MySQL:

sudo start mysql

 

 

Ubuntu - Start MySQL Server - sudo start mysql

 

 

or

 

sudo service mysql start

 

 

Ubuntu Start MySQL Service - sudo service mysql start

 

 

or

(Note: Older Method)

sudo /etc/init.d/mysql start

 

 

Ubuntu Start MySQL Server - Version 3 (older method) - sudo /etc/init.d/mysql start

 

 

 

 

To Stop MySQL:

sudo stop mysql

 

 

Ubuntu Stop MySQL (Newer Method) sudo stop mysql

 

 

or

sudo service mysql stop

 

Ubuntu Stop MySQL (Other Newer Method) sudo service mysql stop

 

or 

(Note: Older Method)

sudo /etc/inid.d/mysql stop 

 

 

Stop MySQL service version 3 (old method) sudo /etc/init.d/mysql stop

 

 

 

 

To Restart MySQL:

sudo restart mysql

 

 

ubuntu restart mysql - sudo restart mysql

 

 

or

sudo service mysql restart

 

 

Ubuntu restart mysql command - sudo service mysql restart

 

 

or

sudo /etc/init.d/mysql restart

 

 

Ubuntu Restart MySQL init.d method

 

 

 

Hope you found this helppful!