Ubuntu thoroughly remove MySQL reinstall MySQL 1. Delete mysql sudo apt-get autoremove -- purge mysql-server-5.0 sudo apt-get remove mysql-server sudo apt-get autoremove mysql-server sudo apt-get remove mysql -common // This is very important 2. Clear residual data dpkg-l | grep ^ rc | awk '{print $2}' | sudo xargs dpkg-P3, install mysql sudo apt- get install mysql-server sudo apt-get install mysql-client sudo apt-get install php5-mysql // installation php5-mysql is to connect php and mysql 4, Once the installation is complete, the MySQL server should be started automatically. Run the following command at the terminal prompt to check whether the MySQL server is running: sudo netstat-tap | grep mysql5. When you run this command, you can see lines similar to the following: tcp 0 0 localhost. localdomain: mysql *: * LISTEN-6. If the server cannot run normally, run the following command to start it: sudo/etc/init. d/mysql restart7, enter mysql $ mysql-uroot-p administrator password 8, configure MySQL administrator password: sudo mysqladmin-u root password newpassword