How to install MySQL 5.7 on Ubuntu 20.04

How to install MySQL 5.7 on Ubuntu 20.04

wget http://repo.mysql.com/mysql-apt-config_0.8.10-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.10-1_all.deb
sudo dpkg-reconfigure mysql-apt-config
sudo apt update
sudo apt-cache policy mysql-server
sudo apt install -f mysql-client=5.7.30-1ubuntu18.04
sudo apt install -f mysql-community-server=5.7.30-1ubuntu18.04
sudo apt install -f mysql-server=5.7.30-1ubuntu18.04

Prevent upgrading to MySQL 8

sudo nano /etc/apt/preferences.d/mysql

Add the following content in the above created file.

Package: mysql-server
Pin: version 5.7.30-1ubuntu18.04
Pin-Priority: 1001

Package: mysql-client
Pin: version 5.7.30-1ubuntu18.04
Pin-Priority: 1001

Package: mysql-community-server
Pin: version 5.7.30-1ubuntu18.04
Pin-Priority: 1001

Package: mysql-community-client
Pin: version 5.7.30-1ubuntu18.04
Pin-Priority: 1001

Package: mysql-apt-config
Pin: version 0.8.10-1
Pin-Priority: 1001

Reference: https://askubuntu.com/questions/1232558/install-mysql-5-7-on-ubuntu-20-04

Leave a Reply

Your email address will not be published.

eleven − 2 =

This site uses Akismet to reduce spam. Learn how your comment data is processed.