De-installation is sometimes not so easy with APT. For example when you screwed up your mysql installation or lost mysql passwords you may want to reinstall mysql and start from scratch again. You probably installed mysql server using:
$ sudo apt-get install mysql-server
Then you might think that you need this command for removal:
$ sudo apt-get remove mysql-server
However, this is not the case. The mysql-server package is a sort of meta-package that makes sure that the latest (and greatest) available mysql server version will be installed. Currently, this means that you actually installed mysql-server version 5.0. Above command will only remove the meta-package, while mysql server 5 happily continues running on your system. To de-install the mysql-server, remove the package, the meta package pulled in:
$ sudo apt-get remove mysql-server-5.0
To also remove the configuration and the binary data, use instead:
$ sudo apt-get remove --purge mysql-server-5.0
# and for ubuntu Gutsy:
$ sudo apt-get purge mysql-server-5.0
Now that mysql server is ‘really’ gone, you can start over and install the mysql-server package:
$ sudo apt-get install mysql-server