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
Some of the above are actually redundant
dpkg -l |grep ^rc|awk '{print $2}'|sudo xargs dpkg -P
sudo apt-get install mysql-server
sudo apt-get install mysql-client
sudo apt-get install php5-mysql
//Install php5-mysql is to connect php and mysql
Once the installation is complete, the MySQL server should start automatically. You can run the following command at the terminal prompt to check whether the MySQL server is running:
sudo netstat -tap | grep mysql
When you run this command, you can see lines similar to the following:
tcp 0 0 localhost.localdomain:mysql : LISTEN -
If the server cannot run normally, you can start it with the following command:
sudo /etc/init.d/mysql restart
Enter mysql
$mysql -uroot -p administrator password
sudo mysqladmin -u root password newpassword
sudo apt-get autoremove mysql-client
sudo apt-get autoremove mysql-client-core-5.5
Reference recommendation:
UBUNTU completely delete MYSQL and reinstall MYSQL
Ubuntu Server 12.04 install mysql 5.6.10 study notes
MySQL 5.1 Reference Manual (recommended)
Recommended Posts