Created
July 27, 2018 14:31
-
-
Save soubrunorocha/ec30b7704d737a1797b0281e97967834 to your computer and use it in GitHub Desktop.
Installing MySQL 8 in silent mode on Ubuntu ( Without prompting )
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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
So I got this working for MySql version 8.0.32.
The trick for me was to run the mysql-apt-config_0.8.24-1_all.deb in interactive mode. Then run the tool
debconf-get-selections | grep mysql-apt-config. That will give you the contents of theEOFblockYou need to run
sudo apt install debconf-utilsto get thedebconf-get-selectionscommand.