If you're using bash scripts to install mysql-server then you might hit a wall because the installation process triggers a prompt for the root password. Here is how you can avoid that.
echo mysql-server mysql-server/root_password password dingo | sudo debconf-set-selections
echo mysql-server mysql-server/root_password_again password dingo | sudo debconf-set-selections
dingo being the password you want set. Include that snippet into your bash script and then install mysql.