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
  • 71,754

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
  • 1
    I wonder why the -1? Are those packages non-functional, or there's some other reason? – oerdnj Jun 25 '13 at 07:24
  • Thanks for the effort! Why is it "experimental"? Will you be maintaining it with future versions/bugfixes? Do you have a (or know of a trustworthy) PPA for PHP 5.5 for 12.04 too? – Dexter Jul 30 '13 at 13:44
  • 1
    @Dexter It's experimental, because it needs testing. I already maintain php5.5 repository in php5-experimental PPA (soon to be moved to php5 PPA). – oerdnj Jul 30 '13 at 13:48
  • 1
    @Dexter JFTR I have now merged the two MySQL PPAs into the one. The ppa:ondrej/php5 has been updates with PHP 5.5 as well and PHP 5.4 can be found in ppa:ondrej/php5-oldstable. – oerdnj Jul 30 '13 at 14:40
  • 1
    @oerdnj: thanks for packaging 5.6 up, but it didn't work for me on a fresh install of raring. Relevant syslog entries are here: https://gist.github.com/rasa/6161973 – Ross Smith II Aug 06 '13 at 04:22
  • @oerdnj: FYI, your mysql-server-5.5 PPA installed just fine – Ross Smith II Aug 06 '13 at 05:52
  • @RossSmithII Could you send it via email? The gist is down at the moment, so I don't forget to look at it. Thanks. – oerdnj Aug 06 '13 at 08:40
  • @RossSmithII The mysql_install_db command is now written in Perl (not Bash) and it requires my-default.cnf and mysql_security_commands.sql to be present in /usr/share/mysql; Als the SQL syntax requires to end each command with semicolon (it's more strict now). – oerdnj Aug 06 '13 at 10:23
  • @RossSmithII I can confirm, that the pristine installation has been fixed in latest mysql-5.6 packages. – oerdnj Aug 06 '13 at 11:52
  • Cool, I will give it a spin, and let you know! Thanks! – Ross Smith II Aug 08 '13 at 22:40
  • @oerdnj: It works! The script I used to install it on a pristine raring64 machine is at https://gist.github.com/rasa/6246057 . I am accepting this answer! – Ross Smith II Aug 15 '13 at 23:58
  • @RossSmithII I am glad it works for you! – oerdnj Aug 16 '13 at 11:08
  • @oerdnj Since 12.10 is now EOL how do you feel about flagging this for deletion since 14.04 now has 5.6 out of the box? – Jorge Castro May 09 '14 at 14:54
  • Does it works for 13.10 also ? Cause I have to change the Distribution from 'saucy' to 'precise'. But it gave error saying 'unable to set root password' – swapab Sep 25 '14 at 09:39
  • I have Ubuntu12.04. I did sudo add-apt-repository ppa:ondrej/mysql, sudo apt-get update and sudo apt-get install mysql-client-5.6 mysql-client-core-5.6 and it worked for me. Thanks – Hussain Tamboli Apr 30 '16 at 06:14
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
  • 71,754
Neuquino
  • 1,469
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,174
  • Stephan, thanks for your help! Unfortunately, I already tried that. It installed ok, but it installed in /opt, and didn't set up anything in /etc, or /etc/init.d, or let me start it with service, or add /opt/mysql/server-5.6/bin to the path, or anything else. – Ross Smith II Oct 20 '12 at 04:50
  • @Ross, try installing MySQL 5.5 first, using apt-get and then install the .deb file over it. – Old Pro Oct 24 '12 at 04:41
  • @OldPro: I don't think that will work, as 5.5 will install in /etc, /usr/bin, etc, and 5.6 will install in opt. – Ross Smith II Oct 24 '12 at 15:20
  • Well so they install in /opt ... Since "the Debian way" is actually just about being a lazy administrator I would live with it and adjust the startup files in /etc/init.d accordingly. Maybe there are even some ready to symlink startup files in /opt. – Paul Hänsch Oct 27 '12 at 22:25
  • An alternative download site here: http://ftp.nchu.edu.tw/Unix/Database/MySQL/Downloads/MySQL-5.6/ – worldsayshi Mar 25 '13 at 09:40
  • I would recommend to use native Debian/Ubuntu packages and not the usual we-are-upstream-and-we-put-everything-in-one-messy-deb approach. See my answer below for .debs. – oerdnj Jun 24 '13 at 13:47
  • Follow the guidelines on how to set up mysql group and user and how to install mysql here: http://dev.mysql.com/doc/refman/5.6/en/binary-installation.html – Ruslans Uralovs Nov 01 '13 at 15:47
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
  • 54,385
empi89
  • 77
  • 1
  • 2
  • 1
    Thanks Eric, a couple things: your comment link is broken on that page also if you need to use the mysql client5.5 with the mysql server 5.6 you need to link the my.cnf to /etc/mysql/my.cnf from /etc/my.cnf – JD Schmidt Jan 16 '14 at 06:08
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.

  • Mik, I really appreciate your answer, but I'm looking for how to do it using the standard Debian method. But thanks! – Ross Smith II Oct 23 '12 at 21:27
  • @RossSmithII see my edit re how doing it the 'Debian way' won't get you the latest version of mysql-5.6. –  Oct 23 '12 at 22:45
  • 1
    Your answer, while very helpful, and informative, does not truly answer the question, as installing from source, the "Debian Way", uses apt-get source -b or dpkg-buildpackage. – Ross Smith II Oct 24 '12 at 16:12
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,353
  • This answer is a duplicate of http://askubuntu.com/a/203335/98419, and my response was: ... I already tried that. It installed ok, but it installed in /opt, and didn't set up anything in /etc, or /etc/init.d, or let me start it with service, or add /opt/mysql/server-5.6/bin to the path, or anything else. – Ross Smith II Oct 31 '12 at 20:10
  • To install MySQL,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 cmd optional

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

    Next cmd optional

    shell> cp support-files/mysql.server /etc/init.d/mysql.server

    – Vikash Singh Nov 01 '12 at 04:20
  • Detailed Description available in the Above mentioned Link :How to install using binary package – Vikash Singh Nov 01 '12 at 04:21
  • Thanks for your follow up. Unfortunately, I'm not asking how to install MySQL 5.6 by hand. This has been documented in numerous places. I'm asking how to install MySQL 5.6 using the standard Debian methods, either the binaries (preferred) or via source. – Ross Smith II Nov 02 '12 at 21:58
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
  • 1
-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,409
  • 2
    Thank you for this link, but it unfortunately, these instruction are for installing the binary manually. the question is how to install mysql using the standard Debian methods, such as apt-get. – Ross Smith II Feb 11 '13 at 20:37