0

I want to install MySQL server on Ubuntu 12.04 LTS non-interactively. For most packages, I just use the -y flag, which is described on the apt-get manpage as:

Automatic yes to prompts; assume "yes" as answer to all prompts and run non-interactively.

But if I try to install mysql-server-5.5 (5.5.40-0ubuntu0.12.04.1) this way, I get a PC-line-art-style dialog box:

While not mandatory, it is highly recommended that you set a password for the MySQL administrative "root" user.

If this field is left blank, the password will not be changed.

I really don't care about a root password here (it's for a dev VM with private networking). I really just need it to run non-interactively. This value is "not mandatory", after all.

What am I missing? How do I install mysql on Ubuntu non-interactively?

1

You can try below commands to install mysql non-interactively

sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password your_password'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password your_password'
sudo apt-get -y install mysql-server

You need debconf-utils installed on your system

sudo apt-get install debconf-utils

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.