1. Delete MySQL
sudo apt-get autoremove--purge mysql-server-5.0sudo apt-get remove Mysql-serversudo apt-get autoremove Mysql-serversudo Apt-get Remove Mysql-common (very important)
Clean up residual data
Dpkg-l |grep ^rc|awk ' {print $} ' |sudo Xargs dpkg-p
2. Install MySQL
sudo apt-get install mysql-serversudo apt-get install mysql-clientsudo apt-get Install Php5-mysql ( Installing Php5-mysql is to connect PHP with MySQL.
Once the installation is complete, the MySQL server should start automatically. You can check whether the MySQL server is running by running the following command at the terminal prompt:
sudo netstat-tap | grep MySQL
When you run the command, you can see a line similar to the following:
TCP 0 0 Localhost.localdomain:mysql *:* LISTEN-
If the server does not function correctly, you can start it by using the following command:
Sudo/etc/init.d/mysql restart
3. Enter MySQL
$mysql-uroot-p Administrator Password
Configure the Administrator password for MySQL:
sudo mysqladmin-u root password newpassword
Completely uninstall MySQL reinstall under Ubuntu