I was wondering about how to do a non-interactive installation of MySQL using apt-get, because it prompts for the root password. I found my answer in an article — Truly non-interactive / unattended apt-get install.
Basically in addition to passing the -q -y arguments to apt-get, you export an environment variable, like this:
# export DEBIAN_FRONTEND=noninteractive # apt-get -q -y install mysql-server-5.0