Install MySQL 5.6 in Ubuntu 16.04
Ubuntu 16.04 only provides packages for MySQL 5.7 which has a range of backwards compatibility issues with code written against older MySQL versions.
Oracle maintains a list of official APT repositories for MySQL 5.6, but those repositories do not yet support Ubuntu 16.04. However, the 15.10 repos will work for 16.04.
Uninstall existing mysql 5.7 if any
sudo apt remove mysql-client mysql-server libmysqlclient-dev mysql-common
Check you removed everything
sudo dpkg -l | grep mysql
Purge remainders (e.g. marked with rc) with
sudo dpkg -P <package> [<package> ...].
Download the apt_config-debian package from Oracle and install it using from https://dev.mysql.com/get/mysql-apt-config_0.8.0-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.0-1_all.deb
Choose "MySQL 5.6" and "Ubuntu Wily" (assuming Xenial is not yet provided) Community reports, that for Ubuntu 17.10, 18.04 you should select "Ubuntu Trusty"
Add repository to unsupported system?
select - ubuntu trusty
Run
sudo apt-cache policy mysql-server
If this shows a 5.6 version, continue.
If not, check your /etc/apt/sources.list.d/mysql.list. It should look roughly like this:
### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out entries below, but any other modifications may be lost.
# Use command 'dpkg-reconfigure mysql-apt-config' as root for modifications.
deb http://repo.mysql.com/apt/ubuntu/ wily mysql-apt-config
deb http://repo.mysql.com/apt/ubuntu/ wily mysql-5.6
deb http://repo.mysql.com/apt//ubuntu/ wily mysql-tools
deb-src http://repo.mysql.com/apt/ubuntu/ wily mysql-5.6
You might have to replace "xenial" with "wily". Although you are using 16.04 (codename Xenial), Oracle currently seems to only provide 5.6 in the repos for 14.04 (codename Wiley). But those sources work for 16.04, too.
Create a file /etc/apt/preferences.d/mysql
with this content
Package: *
Pin: origin "repo.mysql.com"
Pin-Priority: 999
Run
sudo apt-get update
Now recipe's run should provide
sudo apt install mysql-client mysql-server libmysqlclient-dev
You should get 5.6 version now.
Related ansible role: https://github.com/softasap/sa-mysql56
Hi, I am trying to install MySql 5.6 on Ubuntu 18.04 server. I have stuck below .. please advise how can I select ubuntu trusty
[admin@iicubuntu ~]# sudo dpkg -i mysql-apt-config_0.8.0-1_all.deb
Selecting previously unselected package mysql-apt-config.
(Reading database ... 234787 files and directories currently installed.)
Preparing to unpack mysql-apt-config_0.8.0-1_all.deb ...
Unpacking mysql-apt-config (0.8.0-1) ...
Setting up mysql-apt-config (0.8.0-1) ...
debconf: unable to initialize frontend: Dialog
debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
Configuring mysql-apt-config
The detected system (ubuntu bionic) is not supported by MySQL. If you believe
the platform is compatible with one of the supported systems, one of the
corresponding repositories may be selected.
Add repository to unsupported system?
Use of uninitialized value $_[1] in join or string at /usr/share/perl5/Debconf/DbDriver/Stack.pm line 111.
Warning: The postinst maintainerscript of the package mysql-apt-config
Warning: seems to use apt-key (provided by apt) without depending on gnupg or gnupg2.
Warning: This will BREAK in the future and should be fixed by the package maintainer(s).
Note: Check first if apt-key functionality is needed at all - it probably isn't!
Warning: apt-key should not be used in scripts (called from postinst maintainerscript of the package mysql-apt-config)
OK
Use of uninitialized value $val in substitution (s///) at /usr/share/perl5/Debconf/Format/822.pm line 83, line 6.
Use of uninitialized value $val in concatenation (.) or string at /usr/share/perl5/Debconf/Format/822.pm line 84, line 6.
[admin@iicubuntu ~]#