1. delete mysql
sudo apt-get autoremove --purge mysql-server-5.0 //clear configuration sudo apt-get remove mysql-server //清mysql sudo apt-get autoremove mysql-server //Automatic update cleanup sudo apt-get remove mysql-common //clean up common configuration
clean data
dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
2. Installation
sudo apt-get install mysql-server //Server sudo apt-get install mysql-client //client sudo apt-get install php5-mysql //Don't do PHP, don't do it
Once the installation is complete, the MySQL service starts automatically.
You can run the following command to check if the MySQL server is running:
sudo netstat -tap | grep mysql
When you run the command, you can see lines like:
tcp 0 0 localhost.localdomain:mysql *:* LISTEN -
If the server is not functioning properly, you can start it with the restart command:
sudo /etc/init.d/mysql restart
enter mysql
mysql -uroot -p administrator password
Configure the MySQL administrator password:
sudo mysqladmin -u root password newpassword