Disable Automatic Startup of MySQL on Ubuntu

After installing MySQL or MariaDB on your Ubuntu machine, you will notice that it is configure to automatically start.  The install sets rc.d up for it on all runtime levels.  While a running database server isn’t a huge strain on the machine, why waste memory when you don’t have to.  I generally disable this the way you would any init.d service that you don’t use all the time.  Simply type this at a command prompt

sudo update-rc.d mysql disable

and your development machine will no longer start the database automatically.  If you are going to be using MySQL a lot and want to re-enable automatic start, simply type the same changing disable to enable.  With auto-start disabled, you can start/stop your database service by typing

/etc/init.d/mysql start

/etc/init.d/mysql stop

/etc/init.d/mysql restart

Simple enough but I had to look it up the first time 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *