Remove mysql from linux

Some time we face issues related to mysql installation. But even after purging and reinstalling does not solve problem because some of the mysql configuration remains in the system. This post is related to remove mysql from linux and its configuration as well.

  1. Uninstall mysql package
  2. sudo apt-get remove mysql mysql-server
  3. Remove mysql directory
  4. You can find mysql directory path entry for mysql directory in my.cnf with attribute datadir.

    mv /var/lib/mysql /var/lib/mysql_bkp
  5. Install mysql package again
  6. sudo apt-get install mysql mysql-server

Cheers,