MySQL – How to Install MySQL 5.6 on Ubuntu 16.04

16.04MySQL

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?

Best Answer

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.