Created
          October 14, 2014 17:05 
        
      - 
      
 - 
        
Save Exadra37/e8eff4010c90a4ddf60c to your computer and use it in GitHub Desktop.  
    Uninstall / Remove Mysql completely from your Server system
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/bin/bash | |
| # | |
| # Will uninstall / remove completely mysql from your system | |
| # This script was done to work in Ubuntu 13.10, but can be easily modified to work in other distributions | |
| # | |
| # @author Exadra37 | |
| # @version 1.0.0 | |
| # @since 14/10/2014 | |
| # @see http://askubuntu.com/a/172516 | |
| # http://stackoverflow.com/a/16178696 | |
| # | |
| read -p "Are you sure you want to uninstall/remove your current MYSQL INSTALLATION from your system? (yes/no)" -r; | |
| echo; # move cursor to a new line | |
| if [[ "$REPLY" == "yes" ]] | |
| then | |
| echo -e "\nUninstalling MYSQL from your system... Now is too late to regret ;)\n"; | |
| service mysql stop #or mysqld | |
| killall -9 mysql | |
| killall -9 mysqld | |
| apt-get remove --purge mysql-server mysql-client mysql-common | |
| apt-get autoremove | |
| apt-get autoclean | |
| deluser mysql | |
| # you may need to change the path for your distribution | |
| mv /var/lib/mysql /var/lib/mysql_uninstalled | |
| mv /etc/mysql /etc/mysql_uninstalled | |
| rm -rf /var/lib/mysql | |
| rm -rf /etc/mysql | |
| apt-get purge mysql-server-core-5.5 | |
| apt-get purge mysql-client-core-5.5 | |
| echo -e "\nMysql should 100% Uninstalled from your Server..."; | |
| else | |
| echo -e "\nOperation Aborted...\n"; | |
| fi | |
| echo -e "\nINFO: YOU NEED TO RUN THIS SCRIPT AS ROOT...\n"; | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment