Ubuntu – completely remove thesql-server from Ubuntu

MySQLUbuntuubuntu-11.10

I want to completely remove and re-install mysql on Ubuntu 11.10. I've tried removing it by running:

apt-get remove --purge 'mysql-.*'

But when I re-install it, the old databases are still there, so it obviously wasn't completely removes. How do I remove:

  • the server
  • databases
  • configuration files

Best Answer

Delete the default MySQL data directory is /var/lib/mysql. And finally delete the configuration directory that resides in /etc/mysql.

Reinstall and you should be good to go!