Nem limpar nem remover apagará o datadir do mysql .. veja o exemplo
root@mail:~# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 34
Server version: 5.1.41-3ubuntu12.10 (Ubuntu)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database so;
Query OK, 1 row affected (0.00 sec)
mysql> use so;
Database changed
mysql> CREATE TABLE example_autoincrement (
-> id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
-> data VARCHAR(100)
-> );
Query OK, 0 rows affected (0.00 sec)
mysql> INSERT INTO example_autoincrement (data) VALUES ('Hello world');
Query OK, 1 row affected (0.00 sec)
mysql> Bye
root@mail:~# apt-get remove mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libnet-daemon-perl libdbi-perl libhtml-template-perl mysql-server-core-5.1 mysql-client-core-5.1 libdbd-mysql-perl libplrpc-perl mysql-server-5.1 mysql-client-5.1
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
mysql-server
0 upgraded, 0 newly installed, 1 to remove and 49 not upgraded.
After this operation, 131kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 52161 files and directories currently installed.)
Removing mysql-server ...
root@mail:~# ls /var/lib/mysql/
debian-5.1.flag ibdata1 ib_logfile0 ib_logfile1 mail.pid mysql mysql_upgrade_info so
root@mail:~# apt-get install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
mysql-server
0 upgraded, 1 newly installed, 0 to remove and 49 not upgraded.
Need to get 94.8kB of archives.
After this operation, 131kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main mysql-server 5.1.41-3ubuntu12.10 [94.8kB]
Fetched 94.8kB in 0s (98.4kB/s)
Selecting previously deselected package mysql-server.
(Reading database ... 52158 files and directories currently installed.)
Unpacking mysql-server (from .../mysql-server_5.1.41-3ubuntu12.10_all.deb) ...
Setting up mysql-server (5.1.41-3ubuntu12.10) ...
root@mail:~# /etc/init.d^C
root@mail:~# service mysql start
start: Job is already running: mysql
root@mail:~# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 35
Server version: 5.1.41-3ubuntu12.10 (Ubuntu)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| so |
+--------------------+
3 rows in set (0.00 sec)
mysql> Bye
root@mail:~# apt-get purge mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libnet-daemon-perl libdbi-perl libhtml-template-perl mysql-server-core-5.1 mysql-client-core-5.1 libdbd-mysql-perl libplrpc-perl mysql-server-5.1 mysql-client-5.1
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
mysql-server*
0 upgraded, 0 newly installed, 1 to remove and 49 not upgraded.
After this operation, 131kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 52161 files and directories currently installed.)
Removing mysql-server ...
root@mail:~#
root@mail:~#
root@mail:~# ls /var/lib/mysql/
debian-5.1.flag ibdata1 ib_logfile0 ib_logfile1 mail.pid mysql mysql_upgrade_info so
root@mail:~#