11 de fevereiro de 2014

How to install MySQL 5.6 in Ubuntu 12.04 Precise

So, you are using Ubuntu 12.04 Precise Pangolin with MySQL 5.5 installed and you want to upgrade to MySQL version 5.6.

But, before upgrading, you should make a backup of your data:
$ sudo mysqldump -A --events --user=root --password=root > ~/backup_of_mysql_v5.5.sql

Now, let's go on. Since there's no official MySQL 5.6 available through Ubuntu repositories, you can add the unofficial MySQL 5.6 repository and install it with:
$ sudo add-apt-repository ppa:ondrej/mysql-5.6
$ sudo apt-get update
$ sudo apt-get install mysql-server

If you get an error telling you add-apt-repository command was not found, install it with:
$ sudo apt-get install python-software-properties

After installing the new version, you should use mysql_upgrade to convert your tables to newer format:
$ sudo mysql_upgrade --verbose --force --user=root --password=root

Notes:
  1. I assume "root" as your user and password. Change it match your installation.
  2. mysql_upgrade output can be long. So, redirect it to some logfile.
  3. Don't upgrade without a backup. Never!