I'm using the Turnkey Linux virtual machine. The version of Debian in there is apparently on the "Wheezy" upgrade path (if that's what you call it). I'm not completely comfortable with Linux, as you can see.

I need some new features that MySQL 5.6 offers, while my current installation is MySQL 5.5.35. I'd like to get the latest version (5.6.17 as of this posting) or at least any 5.6.x.

I've tried apt-get update, apt-get upgrade, apt-get dist-upgrade. These updated a bunch of things successfully, but none were MySQL. I tried apt-get upgrade mysql-server, which says I already have the latest version.

A Debian Wheezy package repository list on the web shows MySQL 5.5 and nothing else, when I need 5.6. I then read something about "backports", which sounds like it might be able to get me things that my particular Debian isn't supposed to have yet -- but I can't seem to get it working. It requires adding lines to /etc/apt/sources.list.d/sources.list. When I try doing that, then running apt-get update, I get 404 errors.

I've tried several other routes as well, one being compiling the vanilla MySQL download, which I failed at miserably and would rather not try again.

I'm positively baffled at how this is done. Most of the URLs listed on forums/blogs for apt-get, and even for wget, seem to die soon after they're posted, so I can't understand how anyone even goes about finding the right information. I've been trying to do this for two days straight now and can't get anywhere.

So assuming you've read this far, I would love to know if anyone has any way of upgrading MySQL in Debian in some relatively painless automated way (one where I wouldn't have to use make or export/import my current databases and configs manually).

  • Do a backport from testing/unstable/experimental. See How can I install more recent versions of software than what Debian provides?. Better, use PostgreSQL, which already has backports. You write "It requires adding lines to /etc/apt/sources.list.d/sources.list. When I try doing that, then running apt-get update, I get 404 errors." You need to add more details about this if you want help. Commented Apr 18, 2014 at 7:50
  • @faheemMitha Out of curiosity, where'd you find those postgresql backports? I kind of need the new version and slony capabilities and I couldn't find newer than 9.1, which lacks slony. Commented Apr 18, 2014 at 9:40
  • @Shadur: Just do a search for "postgresql debian backports". I think what you want is postgresql.org/download/linux/debian. Often you can get the backports from backports.debian.org, but it seems that currently they are not available from there. Commented Apr 18, 2014 at 12:53
  • @faheemMitha I would paste the full error but I don't have it anymore, and I'm not sure where the backport URLs are that I used anymore. If you nevertheless know of a working line I can plug into my sources.list for backports, I'd love to try it. PS. Switching to a different database platform isn't really an option for me at this point, unfortunately.
    – equazcion
    Commented Apr 18, 2014 at 13:07
  • @equazcion My recommendation is a DIY solution. Fetch the Debian sources from testing (or unstable or experimental), and rebuild them into your own Debian packages. This is really not that hard, and MySQL is unlikely to have hard to resolve dependencies. I explain the basic steps in that answer I linked to. Did you look at it? Commented Apr 18, 2014 at 14:56

3 Answers 3


Currently the best option is to use official MySQL APT repo which allows apt-get upgrade installation.

  • This is probably the best solution because it doesn't require a compiler to be installed. More fool-proof :) Commented Nov 21, 2015 at 15:01
  • This solution work for me. After install, select mysql server version and upgrade apt-get upgrade ,then i to do apt-get upgrade mysql-server, and easy upgrade of mysql from 5.5 to 5.7. After upgrade you need to configure again and execute: mysql_upgrade -u root
    – fermin
    Commented Aug 20, 2018 at 13:14

Rebuilding the experimental 5.6 MySQL sources from experimental on wheezy is easy bordering on trivial. However, you will need lots of disk space; after the build was completed, the build directory was using 5.2 GB. Also, it takes a while to build, and runs an incredible number of tests. I didn't bother to time it, but allow a couple of hours. It is possible to disable the tests, but I suggest letting them run - it is harmless as long as they pass. They did on my machine. The good news is that I was able to build and install it without fuss. I ran the following basic test.

faheem@orwell:~$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 50
Server version: 5.6.16-1~exp1 (Debian)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


So, I can connect to the server at least. Here is what the packages look like installed:

$ dpkg -l | grep mysql

ii  libdbd-mysql-perl                     4.021-1+b1              amd64                   Perl5 database interface to the MySQL database
ii  libmysqlclient18:amd64                5.5.35+dfsg-0+wheezy1   amd64                   MySQL database client library
ii  libqt4-sql-mysql:amd64                4:4.8.2+dfsg-11         amd64                   Qt 4 MySQL database driver
ii  mysql-client-5.6                      5.6.16-1~exp1           amd64                   MySQL database client binaries
ii  mysql-client-core-5.6                 5.6.16-1~exp1           amd64                   MySQL database core client binaries
ii  mysql-common                          5.5.35+dfsg-0+wheezy1   all                     MySQL database common files, e.g. /etc/mysql/my.cnf
ii  mysql-common-5.6                      5.6.16-1~exp1           all                     MySQL 5.6 specific common files, e.g. /etc/mysql/conf.d/my-5.6.cnf
ii  mysql-server-5.6                      5.6.16-1~exp1           amd64                   MySQL database server binaries and system database setup
ii  mysql-server-core-5.6                 5.6.16-1~exp1           amd64                   MySQL database server binaries
ii  python-mysqldb                        1.2.3-2                 amd64                   Python interface to MySQL

Here is a breakdown of the steps.

  1. If you have any of the wheezy MySQL 5.5 packages installed, remove them, they will only cause trouble later. If there are any packages that depend on those, they will have to go too.
  2. First, get the sources. You need to add the following (or similar, adjust for your preferred server) to /etc/apt/sources.list:

    deb-src http://debian.lcs.mit.edu/debian/ experimental main non-free contrib
  3. Also add the following to /etc/apt/preferences.

    Package: *
    Pin: release a=experimental
    Pin-Priority: 1
  4. Then run

    apt-get update
  5. Then run

    apt-get source mysql-5.6

    in some suitable directory. I usually create a directory in /usr/local/src,
    in this case, say /usr/local/src/mysql.

  6. Then cd into /usr/local/src/mysql.

  7. Run

    sudo apt-get build-dep mysql-5.6

    On my machine this installed a couple of packages.

  8. Install some basic packages for building.

    apt-get install build-essential devscripts fakeroot

    Then cd into the resulting source directory /usr/local/src/mysql/mysql-5.6- 5.6.16 and run

    debuild -uc -us

    This will take a while to build. In some cases it is a good idea to increment
    the version number, but it is not really necessary here. as it is unlikely any other MySQL 5.6 package will make its way into wheezy.

    If you don't want to run the tests, you can instead use

    DEB_BUILD_OPTIONS="nocheck" debuild -uc -us
  9. Now you should install libdbd-mysql-perl, which is a runtime dependency of the mysql packages.

     apt-get install libdbd-mysql-perl
  10. Then cd up one level to /usr/local/src/mysql. There should be some deb packages there. You'll want to install at least


    This can be done for example by running:

     dpkg -i mysql-client-core-5.6_5.6.16-1~exp1_amd64.deb         
  • First of all, thanks for this, and all the effort you're putting in. This failed at step 8 though. I seem to not have these /debian/ paths: dpkg-buildpackage: host architecture amd64 fakeroot debian/rules clean Can't exec "fakeroot": No such file or directory at /usr/bin/dpkg-buildpackage line 510. dpkg-buildpackage: error: fakeroot debian/rules clean failed with unknown exit code -1 debuild: fatal error at line 1357: dpkg-buildpackage -rfakeroot -D -us -uc failed I'm doing this in Turnkey Linux which I think utilizes LAMP, if that helps.
    – equazcion
    Commented Apr 18, 2014 at 18:20
  • @equazcion you may not have fakeroot installed. apt-get install fakeroot. Commented Apr 18, 2014 at 18:36
  • Installing fakeroot worked. The final step errored saying it would break MySQL 5.5. I neglected to remove 5.5 as you suggested, because I don't know how, and I wasn't sure how it would affect my current databases. I'm prepared to try this again after removing 5.5, if you want to tell me how to go about doing that in a way that will keep my data available in the new version. I know you're not that familiar with MySQL though and you've spent quite a bit of time on this already. This was a great head start and I can maybe find out how to do the rest by googling around.
    – equazcion
    Commented Apr 18, 2014 at 19:33
  • @equazcion according to dev.mysql.com/doc/refman/5.6/en/… you just need to dump with mysqldump and then reload the dump file. Back your databases as well, of course. Commented Apr 18, 2014 at 20:35
  • Managed to salvage this without redoing all the steps, and didn't need to re-import the databases -- they were already there. For anyone interested, I had to do apt-get remove mysql-server and apt-get remove mysql-client, also had to do apt-get install libterm-readkey-perl before last step. Also, mysql-server-core install in last step had to be done before before mysql-server. I am now officially running MySQL 5.6.16 and have tested full-text InnoDB search indexes successfully (the reason I needed this)! Thank you, Faheem Mitha. You saved my sanity.
    – equazcion
    Commented Apr 19, 2014 at 0:15

All Tested Have fun.

  1. .apt-get install libaio1
  2. groupadd mysql
  3. useradd -r -g mysql mysql
  4. wget -O mysql-5.6.16-debian6.0-x86_64.deb
  5. http://downloads.mysql.com/archives/mysql-5.6/mysql-5.6.16-debian6.0-x86_64.deb
  6. dpkg -i mysql-5.6.16-debian6.0-x86_64.deb
  7. cd /usr/local
  8. ln -s /opt/mysql/server-5.6 mysql
  9. cd mysql
  10. scripts/mysql_install_db --user=mysql
  11. chown -R root .
  12. chown -R mysql data
  13. cp support-files/mysql.server /etc/init.d/mysql
  14. mkdir -p /etc/mysql/conf.d/
  15. cp my.cnf /etc/mysql/
  16. echo $'!include /etc/mysql/my.cnf\n!includedir /etc/mysql/conf.d/' > my.cnf
  17. service mysql start
  18. ./bin/mysql_secure_installation
  • This seemed to be going well until here (sorry for the mess, I don't know how to insert line breaks here): root@lamp local/mysql# update-rc.d mysql-5.7 defaults: update-rc.d: using dependency based boot sequencing update-rc.d: error: unable to read /etc/init.d/mysql-5.7 root@lamp local/mysql# service mysql start: Starting MySQL [FAIL......[....] The server quit without updating PID file (/opt/mysql/server-5.6/data/lamp.pid). ... failed!
    – equazcion
    Commented Apr 18, 2014 at 5:10
  • try with /etc/init.d/mysql start or try pressing tab-tab at /etc/init.d/mys and start it Commented Apr 18, 2014 at 5:17
  • @equazcion Congratulations, now you've discovered why debian sometimes takes a while to come up with an official package for a new version. Commented Apr 18, 2014 at 9:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .