Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

aptitude install mysql-server while throw up a prompt asking for me to set the root password. I'd like to avoid this by specifying the password in the initial command. How do I do this?

share|improve this question
up vote 4 down vote accepted

Have a look at the debconf-set-selections manpage - it should do exactly what you're after.

You should be able to go onto a box with MySQL installed already, and do:-

debconf-get-selections | grep "^mysql-server" >mysql-server-sel.txt

Then copy it to your target box, and run:-

debconf-set-selections mysql-server-sel.txt
apt-get install mysql-server
share|improve this answer
Thanks Andy for the hint. A previous question seems to have the specific answer:… – pr1001 Feb 3 '10 at 20:57
D'oh! Beat me to it ;-) – Andy Smith Feb 3 '10 at 21:03
No worries. ;-) Unfortunately debconf-get-selections doesn't exist in the version of Ubuntu I'm running, so I'll have to hardcode the keynames. – pr1001 Feb 3 '10 at 21:07
Ah - it's in debconf-utils - install that and you should be sorted! – Andy Smith Feb 3 '10 at 21:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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