6

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?

pr1001
  • 225
  • 2
  • 9

1 Answers1

4

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
Andy Smith
  • 1,798
  • 13
  • 15
  • 1
    Thanks Andy for the hint. A previous question seems to have the specific answer: http://serverfault.com/questions/19367/scripted-install-of-mysql-on-ubuntu/19399#19399 – pr1001 Feb 03 '10 at 20:57
  • D'oh! Beat me to it ;-) – Andy Smith Feb 03 '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 03 '10 at 21:07
  • 2
    Ah - it's in `debconf-utils` - install that and you should be sorted! – Andy Smith Feb 03 '10 at 21:08