FeaturesWP CloudPricingEE CLIContactMy Account

Features

Team Access & User Permissions

Server Setup & Management

Site Creation & Management

Deployments & Developer Tools

Firewall Protection

Speed & Caching

Backups & Recovery

Logs & Monitoring

Create WP Cloud Sites

All Features

Read Documentation

Install

Installation Guide

FAQ

Roadmap

Explore EE CLI

Resources

Commands

Handbook

Blog

Community

Forum

EasyExperts

Tutorials

Subscribe

Github

CLEAR

Start For Free

separator Tutorials separator Mysql separator Install/Upgrade to MySQL 5.6 on Ubuntu 12.04 LTS

Topics

On this page

Download & Install MySQL 5.6 deb package from official site

Backup MySQL 5.5 Data

Remove MySQL 5.5 Packages

Setup MySQL 5.6 Startup Script

Update Config & Environment settings

Update environment

Update mysql config file

Start MySQL 5.6

Final Step

Install/Upgrade to MySQL 5.6 on Ubuntu 12.04 LTS

I keep hearing good things about MySQL 5.6, so I decided to give it a try, even Ubuntu 12.04 LTS  do not have launchpad repo for it. (atleast, as of July 10, 2013)

Download & Install MySQL 5.6 deb package from official site

You can get MySQL installers from https://dev.mysql.com/downloads/mysql/#downloads

I ran following command to get MySQL 5.6.14


			wget -O mysql-5.6.deb http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.14-debian6.0-x86_64.deb
		

Then install Mysql 5.6.x


			dpkg -i  mysql-5.6.deb
		

and install dependency


			apt-get install libaio1
		

Backup MySQL 5.5 Data

You will need this only if you are upgrading…


			cd ~ 
mkdir backup && cd backup
mysqldump -A --events > dump/alldb.sql

cp -pr /etc/mysql config

service mysql stop
cp -pr /var/lib/mysql/ data
		

At this point your mysql is stopped and you have mysql’s data directory and mysqldump output in ~/backup directory. If all goes well you will not need backups!

Remove MySQL 5.5 Packages


			apt-get remove mysql-common mysql-server-5.5 mysql-server-core-5.5 mysql-client-5.5 mysql-client-core-5.5
apt-get autoremove
		

Setup MySQL 5.6 Startup Script


			cp /opt/mysql/server-5.6/support-files/mysql.server /etc/init.d/mysql.server
update-rc.d -f mysql remove
update-rc.d mysql.server defaults
		

Note: I am not sure why but renaming mysql 5.6’s startup script from mysql.server to mysql was throwing error.

Update Config & Environment settings

Update environment

MySQL 5.6 directory layout is different than Lauchpad packages.


			vim /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/mysql/server-5.6/bin"
source /etc/environment
		

Confirm changes

Running… which mysql

Should show… /opt/mysql/server-5.6/bin/mysql

Update mysql config file


			vim /etc/mysql/my.cnf
		

			basedir = /opt/mysql/server-5.6
lc-messages-dir = /opt/mysql/server-5.6/share
		

You may also need to tweak few other settings.

For example:table_cache has been renamed to table_open_cache

Start MySQL 5.6

Its time to start new mysql…


			service mysql.server start
		

If you are facing any issue during startup, refer to mysql error log.

Final Step

If you are upgrading from mysql, run command mysql_upgrade

Otherwise if its a fresh install, run following:


			/opt/mysql/server-5.6/scripts/mysql_install_db --user=mysql --datadir=/var/lib/mysql
		

That’s it! Enjoy MySQL 5.6.

Using MariaDB 10

PREVIOUS

Change WordPress Domain Name

NEXT


Comments

  1. Rob Avatar

    Rob

    August 13, 2013

    I run the MySQL upgrade and receive the below error. Have you encountered this before? Other than this everything went smoothly so thank you very much for this tutorial!

    Looking for ‘mysql’ as: mysql
    Looking for ‘mysqlcheck’ as: mysqlcheck
    FATAL ERROR: Upgrade failed

    1. Rahul Bansal Avatar

      Rahul Bansal

      October 14, 2013

      Try solution given in External link to rtcamp.comhttp://rtcamp.com/tutorials/mysql/mysql-5-6-ubuntu-12-04/#comment-64615

  2. himanshu Avatar

    himanshu

    September 1, 2013

    Very helpful.. Thanks

  3. fabrizio Avatar

    fabrizio

    September 6, 2013

    Same problem of Rob here: during “mysql_upgrade” it says:

    Looking for ‘mysql’ as: mysql
    Looking for ‘mysqlcheck’ as: mysqlcheck
    FATAL ERROR: Upgrade failed

    Thanks

    1. fabrizio Avatar

      fabrizio

      September 6, 2013

      Fixed: you need to use

      mysql_upgrade -u root -p

      That’s it

      1. Rahul Bansal Avatar

        Rahul Bansal

        September 6, 2013

        Thanks for sharing your solution. 🙂

        Though error was odd in context of solution…

        1. igid26 Avatar

          igid26

          January 11, 2014

          Everything runs fine for me until the upgrade. I was using 5.5.34 and upgraded to 5.6, but when I try mysql_upgrade -u root -p, it gives me:

          Looking for ‘mysql’ as: mysql
          Looking for ‘mysqlcheck’ as: mysqlcheck
          FATAL ERROR: Upgrade failed

          1. Rahul Bansal Avatar

            Rahul Bansal

            January 12, 2014

            Check mysql error log. There must be something in it indicating reason for issue.

      2. Jose Avatar

        Jose

        March 13, 2014

        mysql_upgrade -u root -p

        Produced…

        “Could not create the upgrade info file ‘/var/lib/mysql/mysql_upgrade_info’ in the MySQL Servers datadir, errno: 13”

        I’ve tried a number of things with the same result: Ran as “sudo”, chmod’ed ‘/var/lib/mysql/mysql_upgrade_info’ to 777.

        There is currently only one line in the file: “5.5.35”.

        Any suggestions? Does this matter if everything else went fine?

  4. kugaevsky Avatar

    kugaevsky

    September 19, 2013

    You didn’t mention that user should run

    /opt/mysql/server-5.6/scripts/mysql_install_db

    if he installing MySQL on clean system. I think it’s important for new linux users.

    1. Rahul Bansal Avatar

      Rahul Bansal

      September 23, 2013

      I already have that command towards end of article:

      /opt/mysql/server-5.6/scripts/mysql_install_db --user=mysql --datadir=/var/lib/mysql
      
  5. Luther Avatar

    Luther

    September 26, 2013

    Thanks for the brilliant howto!

  6. Navneet Avatar

    Navneet

    September 30, 2013

    I am getting following error:

    sh: 1: /opt/mysql/server-5.6/bin/my_print_defaults: not found
    Installing MySQL system tables…sh: 1: /opt/mysql/server-5.6/bin/mysqld: not found

    1. Rahul Bansal Avatar

      Rahul Bansal

      October 14, 2013

      Strange error. Never seen it.

      If its a fresh server, better reinstall mysql. Looks like packages are not installed properly.

  7. John Avatar

    John

    October 10, 2013

    When I try to start mysql I get this in the error log:

    131009 16:25:00 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    /opt/mysql/server-5.6/bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
    131009 16:25:00 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

    I have tried reinstalling libaio1 and also removing+installing it. No change. Any advice? Thanks!

    1. Rahul Bansal Avatar

      Rahul Bansal

      October 14, 2013

      Are you using 32-bit?

      This might be related – External link to stackoverflow.comhttp://stackoverflow.com/questions/10619298/libaio-so-1-cannot-open-shared-object-file

      We shifted to percona-mysql recently so I am sorry but I won’t be able to reproduce this issue. Percona packages are very easy to install and maintain.

      1. John Avatar

        John

        October 14, 2013

        Nice call! The libaio.so.1 file is 64 bit but the mysqld is 32! I must have grabbed the wrong mysql file!

        I’ll remove mysql and start over using a 64 bit version. THANK YOU SO MUCH!

        1. John Avatar

          John

          October 14, 2013

          Final comment: Yes, that fixed it! Woo hoo!

          1. Rahul Bansal Avatar

            Rahul Bansal

            October 15, 2013

            Glad to know that your issue is resolved. 🙂

  8. Paul de Raaij Avatar

    Paul de Raaij

    October 31, 2013

    If your mysql server isn’t starting, problem probably is that it can’t find a system message file. Check for it in the error log and execute the following:

    cp /opt/mysql/server-5.6/share/english/errmsg.sys /usr/share/mysql/errmsg.sys

    The server will start now

  9. tiago Avatar

    tiago

    November 2, 2013

    Starting service mysql on ubuntu with command service mysql.server start and the console say: The server quit without update PID file (/var/run/mysqld/mysqld.pid). Also mysql -u root: can’t could connect to socket at /var/run/mysqld/mysqld.sock. Help me!

    1. Rahul Bansal Avatar

      Rahul Bansal

      November 5, 2013

      Check mysql error log for details.

      Most likely you will find answer there.

    2. André Mácola Avatar

      André Mácola

      March 4, 2014

      I resolve this problem by checking the my.cnf file. I had a duplicated lc-messages-dir line.

      1. Rahul Bansal Avatar

        Rahul Bansal

        March 7, 2014

        Glad to know that your issue got solved. 🙂

  10. Just me Avatar

    Just me

    November 4, 2013

    It’s been a bit since this tutorial was posted. Here are some issues
    I bumped into. The wget will produce a 404. So, you’ll have to go to that
    site directly. Set up an account. Then you’ll get access to that link where
    you can download mysql manually. Then just change the name to “mysql-5.6.deb”
    and start the tutorial on the second step. For those who might not know,
    if you’re not running as root, you’ll
    need to precede these commands with ‘sudo ‘.

    sudo dpkg -i mysql-5.6.deb

    1. josete Avatar

      josete

      November 5, 2013

      Well, the wget works as long as you type in the whole string, including that strange
      /from/http://cdn.mysql.com/

      at the end. That will surpass Sun login screen.

  11. Frank Avatar

    Frank

    November 27, 2013

    Excellent, saved me a lot of time to find it out myself, thanks a lot!

    Cheers, Frank

  12. Koos Kombuis Avatar

    Koos Kombuis

    November 27, 2013

    I get

    user@somewhere:~# wget -O mysql-5.6.deb External link to dev.mysql.comhttps://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.12-debian6.0-x86_64.deb/from/http://cdn.mysql.com/
    –2013-11-27 18:31:14– External link to dev.mysql.comhttps://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.12-debian6.0-x86_64.deb/from/http://cdn.mysql.com/
    Resolving dev.mysql.com (dev.mysql.com)… 137.254.60.11
    Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:443… connected.
    HTTP request sent, awaiting response… 404 Not Found
    2013-11-27 18:31:17 ERROR 404: Not Found.

    1. Koos Kombuis Avatar

      Koos Kombuis

      November 27, 2013

      wget -O mysql-5.6.deb External link to cdn.mysql.comhttp://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.14-debian6.0-x86_64.deb

      1. Rahul Bansal Avatar

        Rahul Bansal

        November 28, 2013

        Thanks for update.

        Looks like they removed old download link. It was latest though when I wrote this article!

        I have updated article with latest link now. Thanks again. 🙂

  13. Digo Freitas Avatar

    Digo Freitas

    January 8, 2014

    Thanks for the tips! I had a little problem with the “table_cache”, but I found it on syslog and it worked like magic, all database still intact.

  14. Mario Avatar

    Mario

    January 25, 2014

    Hey Rahul Bansal,

    That worked just fine to me, thanks! I’m trying to work in some instructions for do the rollback for 5.5 after upgrade using your instructions. But there is a issue related to start mysql service. Did you have this problem? Do you know how to fix it?

    Thanks

    1. Rahul Bansal Avatar

      Rahul Bansal

      January 27, 2014

      Sorry couldn’t understood your problem. Do you having problem during rollback or upgrade?

  15. Mário Areias Avatar

    Mário Areias

    January 27, 2014

    Well, I couldn’t find my last comment here. My problemas is related to do a downgrade, after upgrade. The upgrade went fine. Then I removed the /opt/mysql folder. Also, I changed the MySQL.cnf file to the old condiguration. But when I try to install mysql-server-5.5 again, it fails because the mysql service doesn’t start. Is there anything missing here?

    1. Rahul Bansal Avatar

      Rahul Bansal

      January 27, 2014

      Sorry. Never needed to downgrade back. So really do not have any idea.

      1. Mário Avatar

        Mário

        January 27, 2014

        Sure. Don’t worry. But do you know why the mysql service doesn’t start?

        1. Rahul Bansal Avatar

          Rahul Bansal

          January 28, 2014

          Please check mysql error log. Most likely tail -f /var/log/mysql/mysql-error.log

  16. Stephen Poland Avatar

    Stephen Poland

    January 28, 2014

    Good tutorial, I don’t know if I’m missing something though, I’ve no my.cnf file in /etc – the /etc/mysql directory doesn’t exist. Should I create it and add the two lines?

    sudo find / -iname my.cnf /opt/mysql/server-5.6/mysql-test/suite/ndb_rpl/my.cnf /opt/mysql/server-5.6/mysql-test/suite/rpl_ndb/my.cnf /opt/mysql/server-5.6/mysql-test/suite/ndb_binlog/my.cnf /opt/mysql/server-5.6/mysql-test/suite/federated/my.cnf /opt/mysql/server-5.6/mysql-test/suite/ndb_team/my.cnf /opt/mysql/server-5.6/mysql-test/suite/rpl/extension/bhs/my.cnf /opt/mysql/server-5.6/mysql-test/suite/rpl/my.cnf /opt/mysql/server-5.6/mysql-test/suite/ndb/my.cnf /opt/mysql/server-5.6/mysql-test/suite/ndb_big/my.cnf

    1. Rahul Bansal Avatar

      Rahul Bansal

      January 28, 2014

      You can create my.cnf and add lines to it. Looks like you are installing afresh.

      Try it. If it doesn’t work, just let us know.

  17. Ganesan Avatar

    Ganesan

    February 13, 2014

    while executing this command, I am getting the following issue/

    apt-get install libaio1

    Reading package lists…. Done
    Building dependency tree
    Reading state information…. Done
    package libaio1 is not available, but is referred to by another package.
    This may meant hat the package is missing, has been obsoleted, or
    is only available from another source
    E: Package ‘libaio1’ has no installation candidate.

    1. Rahul Bansal Avatar

      Rahul Bansal

      February 14, 2014

      Search for missing package using command apt-cache search libaio1. May be it’s present in another package. Alternatively, try continuing without that.

      I am sorry but I won’t be able to dig deeper as we have switched to percona-mysql.

  18. Michael Avatar

    Michael

    February 22, 2014

    I had to put the mysql-path at the beginngin of PATH to make which mysql point to opt instead of usr

  19. Ethan Eldridge Avatar

    Ethan Eldridge

    February 27, 2014

    If you get an error like

    Starting MySQL
     * Couldn't find MySQL server (/opt/mysql/server-5.6/bin/mysql/bin/mysqld_safe)
    

    Then there’s a good chance you didn’t set the basedir correctly. Hope that helps someone! (I managed to miss that step and was confused for a bit)

    1. Rahul Bansal Avatar

      Rahul Bansal

      February 28, 2014

      Thanks for sharing your experience. It might help others. 🙂

  20. Vishal Varshney Avatar

    Vishal Varshney

    March 6, 2014

    after this installation my php5 is not working and phpmyadmin and mysql-workbench removes

    1. Rahul Bansal Avatar

      Rahul Bansal

      March 7, 2014

      Sorry to say but I could not understand your problem. Please create a support request, with mysql error log content, in out forum – External link to rtcamp.comhttps://rtcamp.com/support/forum/wordpress-nginx/

Features

Useful Links

Product

Other Products

Subscribe for curated product updates, tips, and announcements.

"*" indicates required fields

X/Twitter

This field is for validation purposes and should be left unchanged.

Email*

SIGN ME UP

Δ


© rtCamp, since 2009. All rights reserved.

Powered by