1. Delete MySQL
A. sudo apt-get autoremove--purge mysql-server-5.0b. sudo apt-get remove Mysql-serverc. sudo apt-get autoremove mysql-serverd. sudo apt-get remove Mysql-common (very important)
In fact, some of the above is redundant, it is recommended to follow the order
2. Clean up residual data
Dpkg-l |grep ^rc|awk ' {print $} ' |sudo Xargs dpkg-p
3. Install MySQL
A. sudo apt-get install Mysql-serverb. sudo apt-get install MYSQL-CLIENTC. sudo apt-get install php5-mysql (Installation Php5-mysql connects PHP to 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:
4. Check if MySQL is running
sudo netstat-tap | grep MySQL
When you run the command, you can see a line similar to the following:
[email protected]:~# sudo netstat-tap | grep mysqltcp 0 0 localhost.localdo:mysql *:* LISTEN
If the server does not function correctly, you can start it by using the following command:
Sudo/etc/init.d/mysql restart
Install MySQL and uninstall MySQL method under Ubuntu