Skip to content

Instantly share code, notes, and snippets.

@POMXARK
Forked from soubrunorocha/install_mysql8_silent.sh
Created October 20, 2023 02:18
Show Gist options
  • Select an option

  • Save POMXARK/3d6ee642dc3edc3665efcdb4fecbd730 to your computer and use it in GitHub Desktop.

Select an option

Save POMXARK/3d6ee642dc3edc3665efcdb4fecbd730 to your computer and use it in GitHub Desktop.
Installing MySQL 8 in silent mode on Ubuntu ( Without prompting )
#update and install some dependencies
sudo apt-get update && apt-get upgrade -y;
sudo apt-get install -y debconf-utils zsh htop libaio1;
#set the root password
DEFAULTPASS="rootpass"
#set some config to avoid prompting
sudo debconf-set-selections <<EOF
mysql-apt-config mysql-apt-config/select-server select mysql-8.0
mysql-community-server mysql-community-server/root-pass password $DEFAULTPASS
mysql-community-server mysql-community-server/re-root-pass password $DEFAULTPASS
EOF
#get the mysql repository via wget
wget --user-agent="Mozilla" -O /tmp/mysql-apt-config_0.8.10-1_all.deb https://dev.mysql.com/get/mysql-apt-config_0.8.10-1_all.deb;
#set debian frontend to not prompt
export DEBIAN_FRONTEND="noninteractive";
#config the package
sudo -E dpkg -i /tmp/mysql-apt-config_0.8.10-1_all.deb;
#update apt to get mysql repository
sudo apt-get update
#install mysql according to previous config
sudo -E apt-get install mysql-server mysql-client --assume-yes --force-yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment