I have an Ubuntu webserver which once used a local database, but we migrated it and now the database is stored remotely on a separate server accessed from many different places. The webserver runs code in PHP and in Python and connects to the remote database using PHP's built-in MySQL support and using Python MySQLdb module.

I'm not longer using the local database on the webserver, and want to remove any unnecessary MySQL server stuff from the webserver because at the moment I have a mysqld process sitting there using 2.8% of my memory and 0.3% of my CPU for no good purpose. I've run

sudo apt-get remove mysql-server
sudo apt-get autoremove
sudo apt-get autoclean

but I'm still able to access the database stored on the web server by typing mysql -u root -p and the mysqld process is still using resources.

I'm pretty timid about fiddling around to try and fix the problem because I don't know which mysql- packages, if any, are depended upon by PHP or MySQLd to connect to the database on the remote database server.

What do I need to do to get rid of the database hosted on the webserver and get rid of the resource-munching mysqld process without breaking the webserver's ability to connect to the remote database?


Actually the easiest way is just to stop it from running unless disk space is a major concern.

How to stop mysql from running at boot time? | Ask Ubuntu

Will explain how to stop it on reboot and an /etc/init.d/mysql stop should stop it for now.

If you absolutely have to remove it I believe your remove, with mysql stopped, should work and leave client libraries unaffected.

  • Feels a bit ugly compared to actually removing the software I no longer need, but screw it - this does everything I need. Disk space of the actual MySQL server program isn't an issue, and I've already dropped the old databases. Thanks. BTW, the remove from my first post definitely doesn't work; trying it again now just gives me Package mysql-server is not installed, so not removed, but I can still restart the service and access MySQL locally. – Mark Amery Mar 8 '13 at 11:51
  • So package data is corrupted now. Either just stop it and ignore it (if you ignore any problem it goes away) or fix the package data, probably with a reinstall then a remove. – Dave C Mar 8 '13 at 12:02
  • 2
    @MarkAmery $0.02 You're looking at it the wrong way around: having to completely remove software like this because you don't know how to control it is a much uglier solution than just learning to control the software. If you are working on a production linux server you should know how to stop and start init (upstart, systemd, whatever) services with confidence and if you don't, start learning. Simply uninstalling things because you don't understand them is a voodoo approach, not a competent one. – goldilocks Mar 8 '13 at 12:16
  • I agree with @goldilocks, except insofar as packages that are broken such that they can't be properly removed are much uglier than that. – davidcl Mar 8 '13 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.