Install MySQL silently

Install MySQL silently, without root password prompt.

export DEBIAN_FRONTEND=noninteractive
apt-get -y install mysql-server
echo "Give mysql server time to start up before we try to set a password..."
sleep 5
mysql -uroot -e <<EOSQL "UPDATE mysql.user SET Password=PASSWORD('$MYSQL_PASSWORD') WHERE User='root'; FLUSH PRIVILEGES;"


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.