How do I uninstall MySQL, PHP, APACHE, NGINX, PHPMYADMIN, mariadb full (ok)

https://www.digitalocean.com/community/questions/completely-uninstall-mysql-server

Đọc bài https://blog.containerize.com/2021/06/04/how-to-install-and-secure-phpmyadmin-with-nginx-on-ubuntu/

To uninstall PHP


sudo apt-get remove –purge php*
sudo apt-get purge php*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get remove dbconfig-php
sudo apt-get dist-upgrade
Note: The output of the below command will provide you with information the installed package software, version, architecture and short description about the package. grep command is used to find the PHP package
sudo dpkg --get-selections | grep php | cut -f 1
sudo apt-get remove --purge <package name from the previous command output>
sudo whereis php
sudo rm -rf <directory/file path from the previous command output>

To uninstall Apache

sudo service apache2 stop
sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
sudo apt-get autoremove
The output of the below command will provide you with information the installed package software, version, architecture and short description about the package. grep command is used to find the MySQL package
sudo dpkg --get-selections | grep apache | cut -f 1
sudo apt-get remove --purge <package name from the previous command output>
sudo whereis apache
sudo rm -rf <directory/file path from the previous command output>

To uninstall MySQL

sudo apt-get remove –purge mysql*
sudo apt-get purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get remove dbconfig-php
sudo apt-get dist-upgrade
The output of the below command will provide you with information the installed package software, version, architecture and short description about the package. grep command is used to find the MySQL package
sudo dpkg --get-selections | grep mysql | cut -f 1
sudo apt-get remove --purge <package name from the previous command output>
sudo whereis mysql
sudo rm -rf <directory/file path from the previous command output>

To uninstall NGINX

sudo apt-get purge nginx*
sudo apt-get autoremove
sudo apt remove nginx
sudo apt-get autoclean
 sudo apt reinstall nginx
 sudo apt-get remove nginx nginx-common
 1. If you want to keep config files
sudo apt-get remove nginx nginx-common
2. If you want to uninstall completely
sudo apt-get purge nginx nginx-common
sudo dpkg --get-selections | grep nginx | cut -f 1
sudo apt-get remove --purge <package name from the previous command output>
sudo whereis nginx
sudo rm -rf <directory/file path from the previous command output>

To uninstall PHPMYADMIN

sudo apt-get purge phpmyadmin*
sudo apt remove autoremove
sudo dpkg --get-selections | grep phpmyadmin | cut -f 1
sudo apt-get remove --purge <package name from the previous command output>
sudo whereis phpmyadmin
sudo rm -rf <directory/file path from the previous command output>
sudo apt reinstall phpmyadmin

To uninstall MADIADB

sudo apt-get remove --purge maria*
 sudo apt-get purge mariadb*
 sudo apt remove autoremove
 apt-get autoclean
 2074  rm -f /var/log/mariadb
 2075  rm -f /var/log/mariadb/mariadb.log
 2076  rm -rf /var/lib/mysql
 2077  rm -rf /usr/lib64/mysql
 2078  rm -rf /usr/share/mysql
 sudo dpkg --get-selections | grep mariadb | cut -f 1
sudo apt-get remove --purge <package name from the previous command output>
sudo whereis mariadb
sudo rm -rf <directory/file path from the previous command output>

Last updated