Find the answer to your Linux question:
Results 1 to 3 of 3
Hey. I've wrote a bash script that completely automates the installation and configuration of a webhosting server. However, when it gets to installing MySQL, it asks to input a password. ...
  1. #1
    Just Joined!
    Join Date
    Dec 2009
    Posts
    2

    Exclamation Bash Automation Problem

    Hey.

    I've wrote a bash script that completely automates the installation and configuration of a webhosting server.

    However, when it gets to installing MySQL, it asks to input a password.

    My question is this.

    Is there a way I can automatically fill in the box?
    I have the password required in a variable called 'sqlpass', but cannot find a way of inputting it into the box.

    It's one of the blue boxes that comes up when dpkg runs.

    "apt-get install mysql-server-5.0"

    I'm doing this on Debian Lenny btw.

    It's been driving me nuts, so any help would be very greatly appreciated.

    Thanks in advance,
    Lee.

  2. #2
    Just Joined!
    Join Date
    Aug 2005
    Posts
    65
    i donno if that will work

    can't u save the password to a file then make dpkg read its input from the file then remove the file , something like
    Code:
    echo $password > passwordFile
    dpkg -i mysql < passwordFile
    rm passwordFile

  3. #3
    Just Joined!
    Join Date
    Dec 2009
    Posts
    2
    Quote Originally Posted by deepinlife View Post
    i donno if that will work

    can't u save the password to a file then make dpkg read its input from the file then remove the file , something like
    Code:
    echo $password > passwordFile
    dpkg -i mysql < passwordFile
    rm passwordFile
    Not too sure that'll work.
    All the packages are downloaded/installed by apt, and it asks you to confirm the password twice.

    So I'm pretty stuck. It's the only thing in the whole script that seems to be causing a problem.

    Any ideas?

    Just to give some context..

    Code:
    apt-get install -y mysql-server-5.0 mysql-client libmysqlclient15-dev
    sed -i -e 's/bind-address/#bind-address/g' /etc/mysql/my.cnf
    mysqladmin -u root password "$sqlpass"
    /etc/init.d/mysql restart
    That's where its being used. You can see mysql-server-5.0 is being installed, and below that the root password should be set, but the blue input box appears before that step

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...