Mysql automated installation stuck

Viewed 613

I have written a script to install some set of packages to a list of servers. When i execute the script mysql installation got stuck at "enter the root password" section. Is there anything i need to modify in my script ? Advice me.

Is there any way to pass the mysql root password through the script itself ?

Below is the code which i used

#!/usr/bin/env bash
read -p "Enter server name : " servername
echo "Installing package on $servername"
ssh "${servername}" sudo apt-get -y install apache2 mysql-server

Installation got stuck here

Even if I enter the password, it wouldn't proceed to the next step. I am very beginner for scripting. Let me know where to modify the script.

2 Answers
Related