Skip to content

Instantly share code, notes, and snippets.

@chrisgalard
Last active October 28, 2019 04:22
Show Gist options
  • Save chrisgalard/a98349b9ee1faf961ffd5ac53e8b99f8 to your computer and use it in GitHub Desktop.
Save chrisgalard/a98349b9ee1faf961ffd5ac53e8b99f8 to your computer and use it in GitHub Desktop.
Uninstall MySQL completely from Ubuntu 8.04

How to uninstall MySQL completely from Ubuntu 18.04

sudo -i

service mysql stop

killall -KILL mysql mysqld_safe mysqld

apt-get --yes purge mysql-server mysql-client

apt-get --yes autoremove --purge

apt-get autoclean

deluser --remove-home mysql

delgroup mysql

rm -rf /etc/apparmor.d/abstractions/mysql /etc/apparmor.d/cache/usr.sbin.mysqld /etc/mysql /var/lib/mysql /var/log/mysql* /var/log/upstart/mysql.log* /var/run/mysqld

updatedb

exit

Installing MySQL again

If you're going to install MySQL again, make sure to execute the following commands before doing so. Otherwise you'll get an error and the installation will get stuck.

  1. mkdir /etc/apparmor.d/abstractions/mysql
  2. mkdir /etc/mysql/conf.d/

I got the commands from this SO thread.

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