A2oz

How Do I Delete MySQL in Ubuntu?

Published in Database Management 1 min read

To remove MySQL from your Ubuntu system, follow these steps:

  1. Stop the MySQL service:

    sudo systemctl stop mysql
  2. Uninstall the MySQL packages:

    sudo apt-get purge mysql-server mysql-client
  3. Remove the MySQL data directory:

    sudo rm -rf /var/lib/mysql
  4. Remove the MySQL configuration files:

    sudo rm -rf /etc/mysql
  5. Clean up the package cache:

    sudo apt-get autoremove
  6. Verify removal:

    dpkg -l | grep mysql

    If no MySQL packages are listed, the removal was successful.

Important Notes:

  • This will completely remove MySQL from your system, including all data and configuration files.
  • Back up your data before proceeding, as this process is irreversible.
  • If you are using a different version of MySQL, such as MariaDB, the package names may vary.

Related Articles