卸载
sudo apt-get --purge remove mysql-common -y
sudo apt-get --purge remove mysql* -y
sudo apt-get autoremove -y
清理数据
dpkg -l |grep ^rc # 如果有输出的话执行 dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
rm -rf mysql/ mysql-files/ mysql-keyring/ /etc/mysql
重装
apt-get install mysql-server -y
来源:https://www.cnblogs.com/aaron-agu/p/8759773.html