Ubuntu: install by bash



Question:

I install mysql-server by bash. But i can't make it auto enter password for root (this image below).

enter image description here

And here's my code.

#!/bin/bash  cd /home/userver2  sudo apt-get -y install mysql-server  113phantom   113phantom  

Any suggestions?


Solution:1

There is a big thread here: https://stackoverflow.com/questions/7739645/install-mysql-on-ubuntu-without-password-prompt

This way, you declare the password before you install the package.

#!/bin/bash  cd /home/userver2  sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password 113phantom'  sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password 113phantom'  sudo apt-get -y install mysql-server  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »