Install mysql 5.6 on Ubuntu 18.04 LTS

I’m unable to install mySql 5.6 on my newly installed Ubuntu 18.04. I have tried solution from lots of links ( link1 link2 … ) but no success at all.

I have 5.7 installed, but due to client’s requirement, I need to do it anyhow.

There are few changes that make it incompatible with 5.6 without making changes in code in around 5 running projects ( 7 developers involved ) which was started when I was using Ubuntu 17.10 with mysql 5.6.

UPDATE: Ahmed has suggested a manual approach which is a good solution but I wish someone knows to do it Ubuntu’s apt way so that more people will be benefited.

This Post Has 2 Comments

  1. No Fault

    The approach that worked
    The only approach that worked was downloading the deb-bundble.tar from MySQL website and installing the packages one by one. I followed these steps:

    Go to MySQL 5.6 download page: https://dev.mysql.com/downloads/mysql/5.6.html#downloads
    In the OS options, select “Ubuntu 14.04 64-bit”
    Download the deb-bundle, a file named: mysql-server_5.6.40-1ubuntu14.04_amd64.deb-bundle.tar, usually, it’s the first option
    Untar the bundle somewhere using: tar -xf mysql-server_5.6.40-1ubuntu14.04_amd64.deb-bundle.tar
    The tar contains multiple deb packages, including mysql-server, mysql-community-server, … etc
    Then I tried to install these using: sudo dpkg -i one-by-one, but I had follow their order according to error messages that fired, e.g.: I first tried: sudo dpkg -i mysql-server_5.6.40-1ubuntu14.04_amd64.deb, it failed because it requires mysql-community-server_5.6.40-1ubuntu14.04_amd64.deb to be installed first and so on. The right order for a few is: mysql-common, mysql-community-client, mysql-client and then mysql-community-server.
    Some of the package installed successfully, some produced errors, after I have tried sudo dpkg -i mysql-server_5.6.40-1ubuntu14.04_amd64.deb for the last time which gave some errors, I desperately tried: sudo apt-get install -f which grabbed the missing dependencies and voila, MySQL Server 5.6 is successfully installed, up and running
    Approaches that didn’t work
    Using Trusty Universal Repo

    It’s worth mentioning that I first tried the same approach that used to work in Ubuntu 16.04, that is, to add the ‘trusty universe’ repo and try installing mysql-server-5.6, i.e. I followed this:

    sudo add-apt-repository ‘deb http://archive.ubuntu.com/ubuntu trusty universe’
    sudo apt-get update
    apt-get install mysql-server-5.6
    This approach did NOT work. It failed because there’s a dependency initscripts that cannot be installed. It seems that it have been replaced after Ubuntu 16.04. Installing it’s replacements: util-util-linux sysvinit-utils didn’t help either.

    Using MySQL apt config package

    I also tried using MySQL config package (mysql-apt-config_0.7.3-1_all.deb) I downloaded from this repo: https://repo.mysql.com/ and installed via: sudo dpkg -i mysql-apt-config_0.7.3-1_all.deb. It didn’t recognize Ubuntu 18.04 (bionic) of course, so, I acted as if it’s xenial and configured MySQL Server version to 5.6, then I tried to check which MySQL version is now available for installation using: apt-cache policy mysql-server but that also didn’t work, I still have later versions than 5.6.

    Final note
    Although the last two approaches didn’t work, they may have contributed to the success of the first approach by making some packages or configuration available, I honestly don’t know.

    When I became hopeless that any approach would work, I considered compiling and installing it from source, I started that endeavor (I installed the build essentials and created the user group and the user) and was about to grab the source code when I stumbled upon the deb-bundle that turned out to be fruitful and was the successful approach I described above.

  2. No Fault

    The only approach that worked was downloading the deb-bundble.tar from MySQL website and installing the packages one by one.

    I followed these steps:

    Go to MySQL 5.6 download page: https://dev.mysql.com/downloads/mysql/5.6.html#downloads
    In the OS options, select “Ubuntu 14.04 64-bit”
    Download the deb-bundle, a file named: mysql-server_5.6.40-1ubuntu14.04_amd64.deb-bundle.tar, usually, it’s the first option
    Untar the bundle somewhere using: tar -xf mysql-server_5.6.40-1ubuntu14.04_amd64.deb-bundle.tar

    The tar contains multiple deb packages, including mysql-server, mysql-community-server, … etc
    Then I tried to install these using: sudo dpkg -i one-by-one, but I had follow their order according to error messages that fired, e.g.: I first tried: sudo dpkg -i mysql-server_5.6.40-1ubuntu14.04_amd64.deb, it failed because it requires mysql-community-server_5.6.40-1ubuntu14.04_amd64.deb to be installed first and so on. The right order for a few is: mysql-common, mysql-community-client, mysql-client and then mysql-community-server.
    Some of the package installed successfully, some produced errors, after I have tried sudo dpkg -i mysql-server_5.6.40-1ubuntu14.04_amd64.deb for the last time which gave some errors, I desperately tried: sudo apt-get install -f which grabbed the missing dependencies and voila, MySQL Server 5.6 is successfully installed, up and running
    Approaches that didn’t work
    Using Trusty Universal Repo

    It’s worth mentioning that I first tried the same approach that used to work in Ubuntu 16.04, that is, to add the ‘trusty universe’ repo and try installing mysql-server-5.6, i.e. I followed this:

    sudo add-apt-repository ‘deb http://archive.ubuntu.com/ubuntu trusty universe’
    sudo apt-get update
    apt-get install mysql-server-5.6
    This approach did NOT work. It failed because there’s a dependency initscripts that cannot be installed. It seems that it have been replaced after Ubuntu 16.04. Installing it’s replacements: util-util-linux sysvinit-utils didn’t help either.

    Using MySQL apt config package

    Also tried using MySQL config package (mysql-apt-config_0.7.3-1_all.deb) I downloaded from this repo: https://repo.mysql.com/ and installed via: sudo dpkg -i mysql-apt-config_0.7.3-1_all.deb. It didn’t recognize Ubuntu 18.04 (bionic) of course, so, I acted as if it’s xenial and configured MySQL Server version to 5.6, then I tried to check which MySQL version is now available for installation using: apt-cache policy mysql-server but that also didn’t work, I still have later versions than 5.6.

    Final note
    Although the last two approaches didn’t work, they may have contributed to the success of the first approach by making some packages or configuration available, I honestly don’t know.

    When I became hopeless that any approach would work, I considered compiling and installing it from source, I started that endeavor I and was about to grab the source code when I stumbled upon the deb-bundle that turned out to be fruitful and was the successful approach I described above.

Leave a Reply