PureDevOps Community

How to remove or uninstall mysql or maria db from ubuntu completely

Note: Your all mysql data will be lost by following the below request.

Make sure that MySQL service is stopped.

sudo systemctl stop mysql
Remove MySQL related all packages completely.

Execute the below command

sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-*

Remove MySQL configuration and data.
If you have changed database location in your MySQL configuration, you need to replace /var/lib/mysql according to it.

sudo rm -rf /etc/mysql /var/lib/mysql
sudo apt autoremove
sudo apt autoclean