Skip to content

Instantly share code, notes, and snippets.

@RickyVaughn2
Last active May 3, 2018 19:43
Show Gist options
  • Save RickyVaughn2/8162573b51203361a2c2087af7991905 to your computer and use it in GitHub Desktop.
Save RickyVaughn2/8162573b51203361a2c2087af7991905 to your computer and use it in GitHub Desktop.
Install MySQL 5.7 in non-interactive mode. Default root password will be "root".
# update
apt-get update && apt-get upgrade -y
# set timezone to cst
echo "America/Chicago" > /etc/timezone
dpkg-reconfigure -f noninteractive tzdata
# uncomment to enable the firewall and poke holes for ssh and mysql
#ufw enable
#ufw allow 22
#ufw allow 3306
# install essential packages
apt-get -y install zsh htop
# install mysql server in a non-interactive mode. default root password will be "root"
echo "mysql-server-5.7 mysql-server/root_password password root" | sudo debconf-set-selections
echo "mysql-server-5.7 mysql-server/root_password_again password root" | sudo debconf-set-selections
apt-get -y install mysql-server-5.7
# run the MySQL secure installation wizard
mysql_secure_installation
sed -i 's/127\.0\.0\.1/0\.0\.0\.0/g' /etc/mysql/my.cnf
mysql -uroot -p -e 'USE mysql; UPDATE `user` SET `Host`="%" WHERE `User`="root" AND `Host`="localhost"; DELETE FROM `user` WHERE `Host` != "%" AND `User`="root"; FLUSH PRIVILEGES;'
service mysql restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment