Skip to content

Instantly share code, notes, and snippets.

@susanBuck
Created June 8, 2023 15:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save susanBuck/6ccfec3aaab4b8559d60dd9f8b7e51ed to your computer and use it in GitHub Desktop.
Save susanBuck/6ccfec3aaab4b8559d60dd9f8b7e51ed to your computer and use it in GitHub Desktop.
Uninstall MySQL (Ubuntu)

Source: Install and configure MySQL / MariaDB (Ubuntu)

Uninstall MySQL (Ubuntu)

To delete MySQL, first run the following command to make sure it’s not running:

> sudo systemctl stop mysql

Then remove MySQL and any of its related packages:

> sudo apt remove --purge mysql-*

Remove the MySQL data directory, configuration file, and logs:

> sudo rm -rf /usr/bin/mysql /var/lib/mysql /etc/mysql /var/log/mysql

Remove any packages that were automatically installed because they were dependencies of MySQL:

> sudo apt-get autoremove

MySQL is now uninstalled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment