卸载mysql
1. sudo apt purge mysql-*
如果出现如下错误:
E: 无法获得锁 /var/lib/dpkg/lock - open (11: 资源暂时不可用)
E: 无法锁定管理目录(/var/lib/dpkg/),是否有其他进程正占用它?
则执行命令:
-
-
-
-
-
-
-
-
- sudo rm /var/lib/apt/lists/lock
- sudo rm /var/lib/dpkg/lock
-
-
-
-
-
-
-
再重新执行步骤1
2. sudo apt-get autoremove mysql-server
3. sudo apt-get remove mysql-common
4. dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P(清理残留)
安装mysql
1. sudo apt-get install mysql-server
2. sudo apt-get install mysql-client