Installing MySQL 5.6 on Ubuntu 14.04 (Trusty Tahr)

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, apt-get install mysql-server-5.6:


root@ubuntu1404:~# apt-get install mysql-server-5.6
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18 libterm-readkey-perl mysql-client-5.6 mysql-client-core-5.6 mysql-common
mysql-common-5.6 mysql-server-core-5.6
Suggested packages:
libclone-perl libmldbm-perl libnet-daemon-perl libplrpc-perl libsql-statement-perl libipc-sharedcache-perl mailx tinyca
The following NEW packages will be installed:
libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18 libterm-readkey-perl mysql-client-5.6 mysql-client-core-5.6 mysql-common
mysql-common-5.6 mysql-server-5.6 mysql-server-core-5.6
0 upgraded, 12 newly installed, 0 to remove and 0 not upgraded.
Need to get 21.5 MB of archives.
After this operation, 164 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirrors.digitalocean.com/ubuntu/ trusty/main libaio1 amd64 0.3.109-4 [6,364 B]
Get:2 http://mirrors.digitalocean.com/ubuntu/ trusty/main mysql-common all 5.5.35+dfsg-1ubuntu1 [14.1 kB]
Get:3 http://mirrors.digitalocean.com/ubuntu/ trusty/main libmysqlclient18 amd64 5.5.35+dfsg-1ubuntu1 [593 kB]
Get:4 http://mirrors.digitalocean.com/ubuntu/ trusty/main libdbi-perl amd64 1.630-1 [879 kB]
Get:5 http://mirrors.digitalocean.com/ubuntu/ trusty/main libdbd-mysql-perl amd64 4.025-1 [99.3 kB]
Get:6 http://mirrors.digitalocean.com/ubuntu/ trusty/main libterm-readkey-perl amd64 2.31-1 [27.4 kB]
Get:7 http://mirrors.digitalocean.com/ubuntu/ trusty/universe mysql-client-core-5.6 amd64 5.6.16-1~exp1 [4,084 kB]
Get:8 http://mirrors.digitalocean.com/ubuntu/ trusty/universe mysql-client-5.6 amd64 5.6.16-1~exp1 [5,591 kB]
Get:9 http://mirrors.digitalocean.com/ubuntu/ trusty/universe mysql-server-core-5.6 amd64 5.6.16-1~exp1 [4,333 kB]
Get:10 http://mirrors.digitalocean.com/ubuntu/ trusty/universe mysql-server-5.6 amd64 5.6.16-1~exp1 [5,839 kB]
Get:11 http://mirrors.digitalocean.com/ubuntu/ trusty/main libhtml-template-perl all 2.95-1 [65.5 kB]
Get:12 http://mirrors.digitalocean.com/ubuntu/ trusty/universe mysql-common-5.6 all 5.6.16-1~exp1 [14.9 kB]
Fetched 21.5 MB in 5s (3,760 kB/s)
Preconfiguring packages ...
Selecting previously unselected package libaio1:amd64.
(Reading database ... 59014 files and directories currently installed.)
Preparing to unpack .../libaio1_0.3.109-4_amd64.deb ...
Unpacking libaio1:amd64 (0.3.109-4) ...
Selecting previously unselected package mysql-common.
Preparing to unpack .../mysql-common_5.5.35+dfsg-1ubuntu1_all.deb ...
Unpacking mysql-common (5.5.35+dfsg-1ubuntu1) ...
Selecting previously unselected package libmysqlclient18:amd64.
Preparing to unpack .../libmysqlclient18_5.5.35+dfsg-1ubuntu1_amd64.deb ...
Unpacking libmysqlclient18:amd64 (5.5.35+dfsg-1ubuntu1) ...
Selecting previously unselected package libdbi-perl.
Preparing to unpack .../libdbi-perl_1.630-1_amd64.deb ...
Unpacking libdbi-perl (1.630-1) ...
Selecting previously unselected package libdbd-mysql-perl.
Preparing to unpack .../libdbd-mysql-perl_4.025-1_amd64.deb ...
Unpacking libdbd-mysql-perl (4.025-1) ...
Selecting previously unselected package libterm-readkey-perl.
Preparing to unpack .../libterm-readkey-perl_2.31-1_amd64.deb ...
Unpacking libterm-readkey-perl (2.31-1) ...
Selecting previously unselected package mysql-client-core-5.6.
Preparing to unpack .../mysql-client-core-5.6_5.6.16-1~exp1_amd64.deb ...
Unpacking mysql-client-core-5.6 (5.6.16-1~exp1) ...
Selecting previously unselected package mysql-client-5.6.
Preparing to unpack .../mysql-client-5.6_5.6.16-1~exp1_amd64.deb ...
Unpacking mysql-client-5.6 (5.6.16-1~exp1) ...
Selecting previously unselected package mysql-server-core-5.6.
Preparing to unpack .../mysql-server-core-5.6_5.6.16-1~exp1_amd64.deb ...
Unpacking mysql-server-core-5.6 (5.6.16-1~exp1) ...
Processing triggers for man-db (2.6.7.1-1) ...
Setting up mysql-common (5.5.35+dfsg-1ubuntu1) ...
Selecting previously unselected package mysql-server-5.6.
(Reading database ... 59386 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.6_5.6.16-1~exp1_amd64.deb ...
Unpacking mysql-server-5.6 (5.6.16-1~exp1) ...
Selecting previously unselected package libhtml-template-perl.
Preparing to unpack .../libhtml-template-perl_2.95-1_all.deb ...
Unpacking libhtml-template-perl (2.95-1) ...
Selecting previously unselected package mysql-common-5.6.
Preparing to unpack .../mysql-common-5.6_5.6.16-1~exp1_all.deb ...
Unpacking mysql-common-5.6 (5.6.16-1~exp1) ...
Processing triggers for ureadahead (0.100.0-16) ...
ureadahead will be reprofiled on next reboot
Processing triggers for man-db (2.6.7.1-1) ...
Setting up libaio1:amd64 (0.3.109-4) ...
Setting up libmysqlclient18:amd64 (5.5.35+dfsg-1ubuntu1) ...
Setting up libdbi-perl (1.630-1) ...
Setting up libdbd-mysql-perl (4.025-1) ...
Setting up libterm-readkey-perl (2.31-1) ...
Setting up mysql-client-core-5.6 (5.6.16-1~exp1) ...
Setting up mysql-client-5.6 (5.6.16-1~exp1) ...
Setting up mysql-server-core-5.6 (5.6.16-1~exp1) ...
Setting up mysql-server-5.6 (5.6.16-1~exp1) ...
2014-04-21 11:50:07 0 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
2014-04-21 11:50:07 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
mysql start/running, process 2355
Setting up libhtml-template-perl (2.95-1) ...
Setting up mysql-common-5.6 (5.6.16-1~exp1) ...
Processing triggers for libc-bin (2.19-0ubuntu6) ...
Processing triggers for ureadahead (0.100.0-16) ...

And then:


root@ubuntu1404:~# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 45
Server version: 5.6.16-1~exp1 (Ubuntu)

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> select version();
+---------------+
| version() |
+---------------+
| 5.6.16-1~exp1 |
+---------------+
1 row in set (0.00 sec)

Update: A slightly more detailed tutorial for this is available here. Thank you internet!

Published by

morgo

I joined MySQL AB in 2006, left, and am now back at Oracle working on the MySQL team. I’ve also worked at Percona and InPowered.

  • Dear Morgan,

    Although in Ubuntu 14.04 repo is updated to MySQL 5.6,

    Recent MySQL Workbench still working with mysql-client-5.5 (mysql-client-core-5.5).
    So when i want to install Latest MySQL Workbench it conflicted with mysql-client-5.6.

  • Tohohaoh

    Seems this tutorial is incomplete… did you ever run this:

    sudo mysql_install_db

    …its full of errors for me, and not RAM errors but other errors.

    1. first can’t find my-default.cnf but i fixed by editing the script

    2. next says timestamp error but i fixed with this:

    sudo mysl_install_db –no-defaults

    3. next has innoDB errors about locking, i try stop and restart mysql but can’t help anything, just so many errors for trying to install mysql 5.6 on ubuntu 14.04

    • From a clean install, this is all that is required. mysql_install_db will be run automatically.

      You can see that I receive warnings about timestamps and using ‘key_buffer’ instead of ‘key_buffer_size’ too. The ubuntu packages set their own config settings in /etc/my.cnf. I actually wish they wouldn’t – MySQL 5.6 has much better defaults.

  • jyothi

    saved my time.. thanq so much

  • TheFrench

    It helped me a lot
    Great thanks !!!

  • Verified and Closed as below:

    http://bugs.mysql.com/bug.php?id=72729

  • sharad chhetri

    Awesome post Morgan, I also would like to thankyou, for referring my blog post.
    Regards
    Sharad
    htttp://sharadchhetri.com

  • Alexis

    Thank you, this is just what I was looking for!

  • TU

    Hello, i’m installing mysql cluster on ubuntu server 14.04. I have a question, should i install mysql.deb before install mysql cluster.tar.gz? Thanks!

  • MEGHANA REDDY

    These are the errors when i am running the first command
    Error: Could not open lock file /var/lib/dpkg/lock – open (13: Permission denied)
    Error: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
    what shall i do now?

    • Yes, the ‘#’ in the prompt indicates that I am root. This appears to be your problem 🙂

      • MEGHANA REDDY

        No i don’t have ‘#’. I have ‘$’

        • Pedro Karut

          you have to type “sudo” and then apt-get …

    • Nitish Das

      Did it work?
      That error usually shows up when there is already an Installation/Update going on. You will have to wait till the other install/update is complete and then try
      sudo apt-get install mysql-server-5.6

  • Geraldo de Azevedo

    Explicação mal dad nenhum dos comandos funcionou no Ubuntu 14.04

  • Arjunsingh Hajari

    Thanks for the version but the above installation gave me such output after the installation

    start: Job failed to start

    invoke-rc.d: initscript mysql, action “start” failed.

    E: Sub-process /usr/bin/dpkg returned an error code (1)

    kindly let me know is there any issue as i run the command as mysql –version it gave the required output

    mysql Ver 14.14 Distrib 5.6.28, for debian-linux-gnu (x86_64) using EditLine wrapper

  • Gokul Raj

    where is mysql/bin located? Can’t seem to find it anywhere.