Is there a way to pass the desired MYSQL password to the prompts in the apt-get install lamp-server^ package in a single command line?

Note: I tried finding the package repository to read up on it, but I can't find it.

  • 1
    No. This must be done when you'll configure your database after installation. – muniz95 Mar 15 '14 at 18:37
  • @muniz95 Actually, if you read the answer below you'll see that this isn't the case. – Seth Mar 23 '14 at 0:10
  • Well, living and learning... – muniz95 Mar 24 '14 at 14:31

You can preset the password:

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 lamp-server^

This is adapted from a SO Question which has a few variants on this idea.

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.