Funcionou como um charme para mim no servidor Ubuntu16 simples:
export DEBIAN_FRONTEND=noninteractive;
MYSQL_ROOT_PASSWORD='xxxxx';
echo debconf mysql-server/root_password password $MYSQL_ROOT_PASSWORD | sudo debconf-set-selections;
echo debconf mysql-server/root_password_again password $MYSQL_ROOT_PASSWORD | sudo debconf-set-selections;
sudo apt-get -y install lamp-server^;