3

Can anyone help me in installing mysql 5.7. I tried following this answer, but when I run

sudo apt-cache policy mysql-server

It gives me:

8.0.20-0ubuntu0.20.04.1 500
    500 http://pk.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
    500 http://pk.archive.ubuntu.com/ubuntu focal-updates/main i386 Packages
    500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
    500 http://security.ubuntu.com/ubuntu focal-security/main i386 Packages
8.0.19-0ubuntu5 500
    500 http://pk.archive.ubuntu.com/ubuntu focal/main amd64 Packages
    500 http://pk.archive.ubuntu.com/ubuntu focal/main i386 Packages
5.7.31-1ubuntu18.04 500
    500 http://repo.mysql.com/apt/ubuntu bionic/mysql-5.7 amd64 Packages
5.7.30-0ubuntu0.18.04.1 500
    500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
    500 http://security.ubuntu.com/ubuntu bionic-security/main i386 Packages

Which are different from the linked answer.

When I tried to

sudo apt install -f mysql-client=5.7.30-1ubuntu18.04

It gives me error

Version '5.7.30-1ubuntu18.04' for 'mysql-client' was not found.

When I run sudo apt install -f mysql-client-5.7 command it installed mysql version. I also does not finds mysql-community-server=5.7.30-1ubuntu18.04.

I tried to run sudo apt install -f mysql-community-server It gives me following error:

mysql-community-server : Depends: mysql-client (= 5.7.31-1ubuntu18.04) but 8.0.20-0ubuntu0.20.04.1 is to be installed
4

Mysql 5.7 is not available to the Ubuntu 20.04. Only mysql 8.0 and higher version are available to Ubuntu 20.04 when you use mysql repository. Here you are using bionic source list (Ubuntu 18.04) for Ubuntu 20.04. I believe this workaround sometimes causes messup with dependencies tree.

You need to download mysql 5.7 packages with their dependencies from official mysql site here and install manually by executing below command in terminal.

sudo dpkg -i <package name>
| improve this answer | |
  • When tried to run ``` sudo dpkg -i mysql-community-server_5.7.31-1ubuntu18.04_i386.deb ``` mysql-community-server:i386 : Depends: perl:i386 but it is not installed – Maaz Anzar Jul 21 at 9:28
  • @MaazAnzar You don't have to install 32 bit packages as well if you're having 64 bit OS. – Kulfy Jul 21 at 12:22
  • Thanks It worked!! I first installed related Libraries and than install mysql – Maaz Anzar Jul 24 at 15:47
2

This:

sudo apt install -f mysql-client=5.7.30-1ubuntu18.04

should be:

sudo apt install -f mysql-client=5.7.31-1ubuntu18.04

I landed on your question with the same problem and solved this by looking here http://repo.mysql.com/apt/ubuntu/dists/bionic/mysql-5.7/binary-amd64/Packages

| improve this answer | |
1

The later error mysql-community-server : Depends: mysql-client (= 5.7.31-1ubuntu18.04) but 8.0.20-0ubuntu0.20.04.1 is to be installed is occurred because of multiple versions of MySQL available. When you tried to install mysql-community-server 5.7, APT tried to fetch latest mysql-client which is 8.0 since all have same priority and that's incompatible with MySQL 5.7.

Though installing packages one by one using DPKG as mentioned by other answer is fine but that may be long manual task.

To make APT fetch mysql-client 5.7, consider changing priorities. To do that run

sudoedit /etc/apt/preferences.d/mysql

and add

Package: mysql-server
Pin: version 5.7*
Pin-Priority: 1001

Package: mysql-client
Pin: version 5.7*
Pin-Priority: 1001

Retry installation process. sudo apt install mysql-server should now fetch 5.7 by default.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.