Delete mysql
1.sudo apt-get autoremove --purge mysql-server
2.sudo apt-get remove mysql-common
Clean up residual data
dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
Reinstall mysql
sudo apt-get update
sudo apt-get install mysql-server //服务端
sudo apt-get install mysql-client //客户端
sudo apt-get install libmysqlclient-dev //程序编译时链接的库
During the installation process, you will be prompted to set a password or something. Pay attention to the setting and don’t forget it. After the installation is complete, you can use the following command to check whether the installation is successful:
sudo netstat -tap | grep mysql
Note: If the myql password is not prompted during the installation process, execute:
cat /etc/mysql/debian.cnf
Check the account and password that comes with it, then log in with this account and password, and then change to the account and password. .