Attempting to purge mysql* on Trust, failing due to confirmation prompy

trusty
mysql

#1

I’m attempting to purge mysql completely before installing Mariadb, which worked great on 12.04, but sadly is failing on 14.04.

This is the command I’m running in depedencies/pre: sudo apt-get purge -y mysql* mariadb*

At some point a prompt appears asking me to confirm removing the directories:

Package configuration┌──────────────────┤ Configuring mysql-community-server ├──────────────────┐│││ This operation will remove the data directory at ‘/var/lib/mysql’ that ││ stores all the databases, tables and related meta-data. Additionally, ││ any import or export files stored at ‘/var/lib/mysql-files’ will be││ removed along with directory, as well as the contents of││ /var/lib/mysql-keyring. It is highly recommended to take data backup││ before removing the data directories.││││ Remove data directories ?││││

Does anyone know how I can automatically say yes? Or ignore this prompt? I already tried simply removing the directories before running the purge, but the prompt still appears.


#2

There are a couple ways to pass yes to commands, try giving some of these a try.


#3

Yea I tried using yes as well as echo but they don’t work. I believe it’s because it’s a dialog menu, not just a stdin prompt.


#4

Anyone still struggling with this, after some battling I managed to remove mysql-server using the following:
machine: pre: - DEBIAN_FRONTEND=noninteractive sudo apt-get --purge autoremove mysql-server


#5