I often do my web development on the move using my laptop. Because of that I must run Apache with PHP and MySQL servers on both my desktop and my laptop PC. You can probably guess that this doesn't help to conserve my laptop battery so I've configured my laptop not to start MySQL and Apache automatically at boot. Instead I start those services manually when I plan to do some coding. In this article I'll show you how to configure your Ubuntu based PC to do the same.
Process of configuring Apache web server not to start at boot is pretty straightforward. We can use Debian's upadate-rc.d to disable Apache service like this:
sudo update-rc.d -f apache2 remove
That's it for Apache. From now on to start Apache web server you can use following command:
sudo service apache2 start
Configuring MySQL not to start at boot is just a little more complicated but also straightforward. First open mysql.conf file with root privileges using your favorite text editor. Here's how to do this using Gedit:
gksudo gedit /etc/init/mysql.conf
Now find following four lines at the beginning of this file:
start on (net-device-up and local-filesystems and runlevel ) stop on runlevel 
To configure MySQL not to start at boot you should add comment sign
# at the beginning of the first three lines like this:
#start on (net-device-up # and local-filesystems # and runlevel ) stop on runlevel 
That's it for the MySQL server. Now you can start it manually using following command:
sudo service mysql start
Easy but useful wasn't it?