When trying to install MariaDB 10.1 in an Ubuntu 16.04 Server with previous MySQL installed, even purging MySQL with sudo apt-get purge mysql*, I get this error message and the install process fail.


To ensure that everything is clean, you not only need to purge MySQL (and MariaDB) with:

sudo apt-get purge mysql* mariadb*

But you also need to remove old MySQL config folders, with:

sudo rm -rf /etc/mysql
sudo rm -rf /var/log/mysql
sudo rm -rf /var/lib/mysql
sudo rm -rf /var/lib/mysql-files
sudo rm -rf /var/lib/mysql-keyring

After these steps and correctly adding the MariaDB repositories, you can finally:

sudo apt update
sudo apt install mariadb-server
  • One liner to remove config folders: sudo rm -rf /etc/mysql && sudo rm -rf /var/log/mysql && sudo rm -rf /var/lib/mysql && sudo rm -rf /var/lib/mysql-files && sudo rm -rf /var/lib/mysql-keyring – Paulo Coghi Oct 18 '18 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.