36

I just installed Ubuntu 12.10 (amd64), and want to install a recent version of MySQL 5.6.

If possible, I would like to install (not upgrade) it the "Debian Way' (i.e., using apt-get or dpkg).

Jorge Castro
  • 73,717

8 Answers8

23

For older releases like 12.10:

(This release is End of Lifed, consider upgrading!)

I have prepared PPA with MySQL 5.6 packages based on MySQL 5.5 Debian packages. No guarantee that it will work right away, but I would be grateful if you can try it and report back success (or failure).

There are PPAs for MySQL 5.5 and MySQL 5.6, both with latest upstream source.

MySQL 5.5: https://launchpad.net/~ondrej/+archive/mysql-5.5

MySQL 5.6: https://launchpad.net/~ondrej/+archive/mysql-5.6

Update: The MySQL 5.6 packages failed on clean install and that has been fixed. If you find more errors please contact me directly via launchpad, or on https://github.com/oerdnj/deb.sury.org/issues

oerdnj
  • 7,940
21

For 14.04 users:

Ubuntu 14.04 defaults to MySQL 5.5, but also has MySQL 5.6 available for installation from the universe archive. Installing 5.6 is as easy as specifying the version:

myuser@mypc:~$ sudo apt-get purge mysql-server-5.5 mysql-client-5.5
myuser@mypc:~$ sudo apt-get autoremove
myuser@mypc:~$ sudo apt-get install mysql-server-5.6 mysql-client-5.6

Check the Tocker's site for more details

Jorge Castro
  • 73,717
Facundo Ch.
  • 1,459
11

you can download the latest .deb file at oracle.com

oracle dev download site

and simply run the command

dpkg -i mysql-5.6.7-rc-debian6.0-x86_64.deb

I didn't install it though, so i can't promise the expected result.

Stefan
  • 1,184
4

I have just written a blogpost that covers this topic. Find it at Mysql 5.6 installation. Hope this will help you!

Eric Carvalho
  • 55,453
empi89
  • 77
  • 1
  • 2
2

You can of course install everything required for Mysql-5.5 from the repositories in both 12.04 and 12.10, but the following should help you get Mysql-5.6 installed.

Firstly, I should try installing the deb file from the official site in Software Centre or Gdebi, as those programs resolve dependencies, dpkg doesn't.


Compiling mysql is your next option:

Note: Doing it the 'Debian way' (as you mention) will only get you mysql-5.5 and not 5.6: i.e.

sudo apt-get source mysql-5.5

as there isn't any other source available by default. If you want to use the latest development code you have to download it from the official site, which is better than trying to enable some unstable repository or another.

There are also no ppas available at the present time (other than the one you have tried), so the following way of compiling mysql-5.6 is actually the easiest and only way at the minute of getting what you want.


However, as you say you are interested in compiling the latest development version of mysql 5.6, the following instructions should help you:

Download the latest development source code from the mysql site and verify the download. At the present time you want mysql-5.6.7-rc.tar.gz; go down the page, select development releases and then select source code in the box.

Now, run

tar xzvf mysql-5.6.7-rc.tar.gz

cd to the folder and create a folder called bld:

cd mysql-5.6.7-rc
mkdir bld
cd bld

At this point it is important to fetch the dependencies with

sudo apt-get install build-essential cmake libaio-dev

Important documentation is available here on the build process, but what you probably want to do is just use the standard options that the official build uses. For that, as noted here, please run (while in the bld folder):

cmake -DBUILD_CONFIG=mysql_release .. 

Then when the cmake configure has finished and is satisfied (take note of any missing dependencies it mentions; if there are any missing ones download them and then delete everything in the bld directory and run the above cmake command again)

Now you are ready to run the compile with make and any options that you may add:

make

When the compile has finished (it will take about an hour), run either

sudo make install or sudo checkinstall

Now, you should have a mysql installation. Any further information should be available in the very detailed official guide.

1

My SQL 5.6 is available for download here : My SQL 5.6 Download

I think you will have to go with the non - rpm package at the very bottom of the list.

And here you may find details on how to install this version : How to install using binary package

Hope this helps :)

To install and use a MySQL binary distribution, the basic command sequence looks like this:

shell> groupadd mysql
shell> useradd -r -g mysql mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data

Next command is optional

shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> bin/mysqld_safe --user=mysql &

Next command is optional

shell> cp support-files/mysql.server /etc/init.d/mysql.server
Vikash Singh
  • 2,383
0

Here is another approach compared to empi89 's answer, using a modified mysql init script. Yes this is manual, but this is the price you pay to be on the bleeding edge. Oracle does not provide a repository. Have a look at this post.

EDIT: In brief, you can copy the original /etc/init.d/mysql to /etc/init.d/mysql-opt and modify it as appropriate:

  1. Replace /etc/mysql/my.cnf with /etc/mysql/my-opt.cnf
  2. Replace calls to mysql binaries with the opt ones (e.g. /usr/bin/mysqld_safe to /opt/mysql/server-5.6/bin/mysqld_safe)
  3. Replace the call to /etc/mysql/debian-start with /etc/mysql/debian-start-opt

Then, copy /etc/mysql/debian-start to /etc/mysql/debian-start-opt and edit as appropriate:

  1. Replace calls to mysql binaries with the opt ones (e.g. /usr/bin/mysqld_safe to /opt/mysql/server-5.6/bin/mysqld_safe)
  2. Make it executable

    # chmod a+x /etc/mysql/debian-start-opt
    

Then, copy /etc/mysql/my.cnf to /etc/mysql/my-opt.cnf and edit:

  1. Under the section [mysqld_safe], add the following line:

     mysqld = mysqld --defaults-file=/etc/mysql/my-opt.cnf
    
  2. Under the section [mysqld], modify the following lines:

     basedir = /opt/mysql/server-5.6
     lc-messages-dir = /opt/mysql/server-5.6/share
    
  3. Also if you have this enabled, like I did

     log_slow_queries = <log>
    

    which now is deprecated, it should be replaced by the following two lines:

     slow-query-log = TRUE
     slow-query-log-file = <log>
    

Time for testing Stop mysql

# /etc/init.d/mysql stop

Keep a data backup just in case you will need to revert the old data

# cp -rp /var/lib/mysql /var/lib/mysql.old

Make init script executable

# chmod a+x /etc/init.d/mysql-opt

Test mysql-opt starts.

NOTE: This will update you current mysql internal tables. You did make the data backup, didn’t you ?

# /etc/init.d/mysql-opt start

Check the logs for errors. During debuging a server that doesn’t start you can manually issue

# /opt/mysql/server-5.6/bin/mysqld_safe --defaults-file=/etc/mysql/my-opt.cnf

If everything went ok, you can enable the opt mysql server during startup. Disable the old script from running at init.

# update-rc.d -f mysql remove

Install the new, ignoring the warnings.

# update-rc.d mysql-opt defaults

Verify it is installed.

# ls -l /etc/rc3.d | grep mysql

The previous command should now output something like:

lrwxrwxrwx 1 root root 19 May 10 15:55 S17mysql-opt -> ../init.d/mysql-opt
basos
  • 11
-2

Here you have all the instructions to install it from binaries, plus the steps to install it in /usr/bin and configure as service as you asked for...

Mysql 5.6 installation

Hojat Taheri
  • 5,539