How can I upgrade MySQL in Debian using apt-get?
Currently the best option is to use official MySQL APT repo which allows apt-get upgrade
installation.
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
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
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.
- 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.
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
Also add the following to
/etc/apt/preferences
.Package: * Pin: release a=experimental Pin-Priority: 1
Then run
apt-get update
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
.Then cd into
/usr/local/src/mysql
.Run
sudo apt-get build-dep mysql-5.6
On my machine this installed a couple of packages.
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 rundebuild -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
Now you should install libdbd-mysql-perl, which is a runtime dependency of the mysql packages.
apt-get install libdbd-mysql-perl
Then cd up one level to
/usr/local/src/mysql
. There should be some deb packages there. You'll want to install at leastmysql-client-core-5.6_5.6.16-1~exp1_amd64.deb mysql-common-5.6_5.6.16-1~exp1_all.deb mysql-server-5.6_5.6.16-1~exp1_amd64.deb mysql-client-5.6_5.6.16-1~exp1_amd64.deb mysql-server-core-5.6_5.6.16-1~exp1_amd64.deb
This can be done for example by running:
dpkg -i mysql-client-core-5.6_5.6.16-1~exp1_amd64.deb mysql-common-5.6_5.6.16-1~exp1_all.deb mysql-server-5.6_5.6.16-1~exp1_amd64.deb mysql-client-5.6_5.6.16-1~exp1_amd64.deb mysql-server-core-5.6_5.6.16-1~exp1_amd64.deb