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.

  • Do you have any other version of mysql currently installed? Do you need 5.6 specifically? 5.7 is available in the default repos. – valiano Apr 29 '18 at 18:29
  • @valiano , 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 without having to do changes of code in more than 5 developers involved in project. – Purushotam Sangroula Apr 30 '18 at 1:52
  • Have you tried this? askubuntu.com/questions/792571/… – valiano May 1 '18 at 13:02
  • @valiano that answer is not applicable currently. I've tried. – Purushotam Sangroula May 1 '18 at 16:30
  • Do you need MySQL, or can you live with MariaDB, which is 100% compatible with all existing MySQL databases? – NerdOfLinux May 7 '18 at 12:45

I've tried many approaches until I was successful.

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 <package-name> 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.

| improve this answer | |
  • Hello Ahmed, I'm so happy to see you posting this hard work of yours. I know this solutions should work (as I've done this way at last) but I would like to do it more Ubuntu apt way. There must have been some way to do it. Thank you for this solution. – Purushotam Sangroula May 2 '18 at 10:36
  • 1
    Thank you @anime. Considering that Ubuntu 18.04 was released about a week ago, it's expected that no one yet has done a fix or a third party repo to install it via apt. – Ahmed Moawad May 2 '18 at 12:26
  • Mysql has updated the apt-repo to mysql-apt-config_0.8.10-1_all.deb. Which will and does support Bionic HOWEVER they have only included 5.7 and 8 as options in that repo...so no 5.6 from mysql at this stage for bionic – Narrim May 5 '18 at 21:51
  • 2
    The order that worked for me: sudo dpkg -i mysql-client_* mysql-community-server_* mysql-server_* mysql-community-source_* libmysqlclient18_* libmysqlclient-dev_* libmysqld-dev_* mysql-community-client_* mysql-community-bench_* mysql-common_* mysql-community-test_* mysql-testsuite_* – brandones Jul 10 '18 at 20:57
  • Nice of you. You added the things that worked and the things that didn't. – Soundararajan Sep 6 '18 at 11:33

Perhaps a bit offtopic, but my prefered way of solving things like this is to use docker.

you can install docker and docker-compose. Create a docker-compose.yml file, in example /home/whatever/mysql-5.6 that looks like this.


    image: mysql:5.6
    restart: always
      MYSQL_ROOT_PASSWORD: example

and then do docker-compose up -d

Alternativly you can just install docker-ce, and do a "dryrun" of the image whit the following command to just check it out.

docker run -it mysql:5.6 /bin/bash

Full explanation of the mysql Dockerfiles, here. https://hub.docker.com/_/mysql/

| improve this answer | |
  • This is probably the correct way to do it these days. – marcogmonteiro Apr 7 '19 at 16:11

You can download & install Mysql 5.6 debian packages manually from Mysql apt repository.

| improve this answer | |
  • Thanks, but no. On Ubuntu 18.04 the official MySQL repo (the APT package) gives you only the option of MySQL 5.7 or 8.0. Just tried it. – Paul Jul 22 '18 at 17:00
  • Edited answer with URL where you can download mysql 5.6 debian packages. – KK Patel Jul 22 '18 at 21:35

MariaDB is a fully compatible drop-in replacement for MySQL, and is available in the default Ubuntu repositories. It can be installed with:

sudo apt update
sudo apt install mariadb-server-10.0 mariadb-client-10.0

The setup should detect all existing MySQL databases and import them, but just in case, read this answer, and have a backup ready.

Notes about MariaDB

While the question is about MySQL, MariaDB

is an enhanced, drop-in replacement for MySQL

and is compatible with all* applications that use MySQL. It listens on the same ports and all the commands are the same(i.e. mysql,mysqldump, etc.).

*Ok, you can probably find some really old applications that won't work with MariaDB, but the chances of that are really, really small.

| improve this answer | |
  • How do we setup mySql version in it? – Purushotam Sangroula May 7 '18 at 15:08
  • I don't believe you can. I recommend you try it on a VPS to make sure everything works before making it live. The link will give you up to 2 months free(and help me out a bit :-) ), but any VPS provider will do – NerdOfLinux May 7 '18 at 15:10
  • From what I see with 18.04. where is only mariadb-server-10.1 ... – wittich Jul 24 '18 at 6:24

I know this answer is a little bit late. but, i had to mention that current version of MySQL APT Repository (mysql-apt-config_0.8.12-1_all.deb) worked fine with me on Ubuntu 18.04.

here is how to use it.

| improve this answer | |
  • Will this allow installation of mysql 5.6 on Ubuntu 18.04? – iii Jun 22 '19 at 19:03
  • Upon depackaging, it only gives me the option of 8.0 – iii Jun 22 '19 at 19:17
  • It worked fine with me using the mentioned version on the date of this answer – KhogaEslam Jun 23 '19 at 8:21

Yes! you can install MySQL 5.5.56 following these Installation instructions.

| improve this answer | |
  • 1
    Thanks so much for contributing to AskUbuntu! That said, I did want to point out two pieces of hopefully constructive criticism about your answer. First, the OP is specifically looking for a solution using traditional package management tools. They commented that the upvoted answer, while totally good, wasn't what they're looking for. With raw tarballs, yours is even farther removed. The other concern is the raw link. In describing a good answer askubuntu.com/help/how-to-answer context and fuller explanations are recommended. I hope that helps with further contributions to the site! – wxl Jul 29 '19 at 15:35

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.