How to install mysql 8.0 on ubuntu 20.04 LTS

add repository for mysql apt

add apt key

sudo apt-key adv --keyserver pgp.mit.edu --recv-keys 5072E1F5

Or use the following command to add mysql apt key

curl -fsSL http://repo.mysql.com/RPM-GPG-KEY-mysql | sudo apt-key add -

add repository

  Generate file /etc/apt/sources.list.d/mysql.list

sudo tee /etc/apt/sources.list.d/mysql.list <<-'EOF'
# Use command 'dpkg-reconfigure mysql-apt-config' as root for modifications.
deb [arch=amd64] http://repo.mysql.com/apt/ubuntu/ focal mysql-apt-config
deb [arch=amd64] http://repo.mysql.com/apt/ubuntu/ focal mysql-8.0
deb [arch=amd64] http://repo.mysql.com/apt/ubuntu/ focal mysql-tools
deb [arch=amd64] http://repo.mysql.com/apt/ubuntu/ focal mysql-tools-preview
EOF

Or with Tsinghua‘s mirror

sudo tee /etc/apt/sources.list.d/mysql.list <<-'EOF'
# Use command 'dpkg-reconfigure mysql-apt-config' as root for modifications.
deb [arch=amd64] http://repo.mysql.com/apt/ubuntu/ focal mysql-apt-config
deb [arch=amd64] http://mirrors.tuna.tsinghua.edu.cn/mysql/apt/ubuntu focal mysql-8.0
deb [arch=amd64] http://mirrors.tuna.tsinghua.edu.cn/mysql/apt/ubuntu focal mysql-tools
deb [arch=amd64] http://mirrors.tuna.tsinghua.edu.cn/mysql/apt/ubuntu focal mysql-tools-preview
EOF

update apt local metadata

apt update

install

sudo apt-get install -y mysql-client mysql-workbench-community

Reference

  • A Quick Guide to Using the MySQL APT Repository

你可能感兴趣的:(RDS,mysql,install,ubuntu)