46

It seems that Ubuntu 16.04 is coming with MySQL 5.7, however I need to install 5.6.

When I try to install it explicitly sudo apt-get install mysql-server-5.6 I get the following error:

Package mysql-server-5.6 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  mysql-community-server:i386 mysql-common:i386 mysql-community-server mysql-common percona-xtradb-cluster-server-5.6:i386 percona-server-server-5.6:i386 mysql-testsuite-5.7:i386
  mariadb-server-10.0:i386 percona-xtradb-cluster-server-5.6 percona-server-server-5.6 mysql-testsuite-5.7 mariadb-server-10.0 mysql-server-core-5.7:i386 mysql-server-5.7:i386 mysql-server-core-5.7
  mysql-server-5.7

Is there any way to install 5.6?

Tarlog
  • 669

6 Answers6

75

I used the following approach:

sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty universe'
sudo apt-get update
sudo apt install mysql-server-5.6 mysql-client-5.6

If an error occurs during the execution of the last command take a look at the comment section of this answer.

David Foerster
  • 36,890
  • 56
  • 97
  • 151
basex
  • 866
10

Looks that I managed to do it.

  1. In Software & Updates/Other Software added 14.04 repository:

    deb http://archive.ubuntu.com/ubuntu trusty main
    
  2. Installed mysql client and server:

    sudo apt install mysql-server-5.6
    sudo apt install mysql-client-5.6
    

Update: Before installing 5.6, make sure that no other mysql packages are present:

dpkg -l | grep mysql - returns list of mysql packages.

Use apt-get purge <package name> to purge them.

Source: 16.04 upgrade broke mysql-server

Tarlog
  • 669
9

I was facing same issue and I have performed simple steps below:

 sudo apt-get install software-properties-common
 $ sudo add-apt-repository -y ppa:ondrej/mysql-5.6
 $ sudo apt-get update
 $ sudo apt-get install mysql-server-5.6

Solution worked for me Cheers!!

Ramesh Chand
  • 7,564
3
dpkg --force-depends -P `dpkg -l |awk '/mysql/{print $2}'`

rm -r /etc/mysql/

apt-get install mysql-server mysql-client
amc
  • 7,292
1

I had the same problem, and I tried a lot of options. And I had a lot of problems with libdbd-mysql-perl; the system said that was not going to install that library.

So I thought to install it with the Aptitude that install a package and correct all the dependencies.

If you don't have aptitude you can get it like this:sudo apt-get install aptitude

First all you need to uninstall your existing mysql. Next you need to install the package that you want.

sudo aptitude install mysql-server-5.6

The aptitude give you a lot of option, what to do. The first options is to keep the actual package. So press (N)o until you find the option that say to downgrade the next packages:

libmysqlclient20 [5.7.14-1ubuntu16.04 (<NULL>, now) -> 5.7.13-0ubuntu0.16
mysql-common [5.7.14-1ubuntu16.04 (<NULL>, now) -> 5.6.30-1+deb.sury.org

then press (Y)es and the aptitude is going to install the mysql-server-5.6. Here's the option that you should accept:

enter image description here

If after that the system cannot connect to mysql server you need to restart your computer.

Zanna
  • 72,312
rebduvid
  • 111
1

The MySQL developers provide Xenial packages of MySQL 5.6 in their own repositories, and this should thus be preferred over installing the official Ubuntu Trusty packages, since it is in general better to install packages which were created for your version of Ubuntu.

If you already have MySQL Server packages, you should first uninstall them; just uninstall everything that is shown by dpkg -l | grep mysql-server.

Just download and install the mysql-apt-config DEB package in the previous link. During the installation, it will ask which version you want, so you can choose 5.6. After the package is done installing, sudo apt update && sudo apt install mysql-server-5.6 will install MySQL Server 5.6.

fkraiem
  • 12,813