Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
MySQL 8 Installation - Ubuntu 18.04 / 20.04 LTS
#!/usr/bin/env bash
echo PURGE | sudo debconf-communicate mysql-community-server
sudo apt purge mysql-client mysql-server
sudo debconf-set-selections <<< "mysql-community-server mysql-community-server/root-pass password $password"
sudo debconf-set-selections <<< "mysql-community-server mysql-community-server/re-root-pass password $password"
sudo debconf-set-selections <<< "mysql-community-server mysql-server/default-auth-override select Use Legacy Authentication Method (Retain MySQL 5.x Compatibility)"
sudo apt install -y dirmngr
sudo apt-key adv --keyserver --recv-keys 5072E1F5
echo "deb $(lsb_release -sc) mysql-8.0" | sudo tee /etc/apt/sources.list.d/mysql80.list
sudo apt-get update
export DEBIAN_FRONTEND="noninteractive"
sudo apt-get install mysql-server
Copy link

chorrell commented May 27, 2022

I would recommend using as the key server, e.g.,

sudo apt-key adv --keyserver --recv-keys 3A79BD29

From my experience with docker images, the server isn't very reliable. Also, the signing key is now 3A79BD29 since MySQL 8.0.28:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment