Skip to content

Instantly share code, notes, and snippets.

@ffund
Last active February 16, 2021 20:02
Show Gist options
  • Save ffund/19f0bfbb9d5c6bc86a9156c0a3c63577 to your computer and use it in GitHub Desktop.
Save ffund/19f0bfbb9d5c6bc86a9156c0a3c63577 to your computer and use it in GitHub Desktop.
MySQL unattended install
sudo apt-get update
ROOT_SQL_PASS=root
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password password $ROOT_SQL_PASS"
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $ROOT_SQL_PASS"
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server
IP=$(/sbin/ip -o -4 addr list eth1 | awk '{print $4}' | cut -d/ -f1)
sudo sed -i "s/127.0.0.1/$IP/g" /etc/mysql/mysql.conf.d/mysqld.cnf
sudo service mysql restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment