Ubuntu: Completely remove and clean MySQL installation


Stop mysql:
# /etc/init.d/mysql stop

Remove packages:
# sudo apt-get remove --purge mysql-server
# sudo apt-get remove --purge mysql-common
# sudo apt-get remove --purge mysql-client

# apt-get autoremove
# apt-get autoclean


Find any other mysql packages (remove if any found):
# dpkg --get-selections | grep mysql

Delete user and group:
# deluser mysql
# delgroup mysql


# rm -Rf /etc/mysql/

Find any other file with mysql in it:
# find / -iname ‘mysql*’