ubuntu16.04 徹底刪除mysql
阿新 • • 發佈:2018-12-19
以MySQL- 5.7.18為例:
sudo apt-get autoremove --purge mysql-server-5.7 #sudo apt-get remove mysql-server # 沒用到,已經沒有mysql-server #sudo apt-get autoremove mysql-server # 沒用到,已經沒有mysql-server sudo apt-get remove mysql-common sudo rm -rf /etc/mysql/ /var/lib/mysql #很重要 #清理殘留資料 dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P sudo apt autoremove sudo apt autoreclean
執行dpkg -l |grep ^rc|awk ‘{print $2}’ |sudo xargs dpkg -P ,效果圖:
安裝MySQL:
sudo apt-get install mysql-server
sudo apt-get install mysql-client
sudo apt-get install libmysqlclient-dev
啟動、關閉服務和檢視執行狀態
sudo service mysql start
sudo service mysql stop
sudo service mysql status