First, you need to get MySQL installers from

I ran following command to get MySQL 5.6.14(32bit):
wget -O mysql-5.6.14.deb

Install dependency
sudo apt-get install libaio1

Then install Mysql 5.6.14
sudo dpkg -i mysql-5.6.14.deb

Backup your 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

This is your backup folder & data in case if of anything. But if everything when well, you will not need the backups.

Remove MySQL 5.5 Packages
sudo apt-get remove mysql-common mysql-server-5.5 mysql-server-core-5.5 mysql-client-5.5 mysql-client-core-5.5
sudo 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

Update environment
sudo nano /etc/environment
source /etc/environment

Confirm changes
Run this command:
which mysql

Should show:

Update mysql config file
sudo nano /etc/mysql/my.cnf
basedir = /opt/mysql/server-5.6
lc-messages-dir = /opt/mysql/server-5.6/share

Start MySQL 5.6
Its time to start new mysql…
service mysql.server start

If you cannot start mysql server, then install this package:
sudo apt-get install ia32-libs php5-mysql

Then try to start it again.

Final Step
If you are upgrading from mysql, run this command:
mysql_upgrade -u root -p

Otherwise if its a fresh install, run following:
/opt/mysql/server-5.6/scripts/mysql_install_db –user=mysql –datadir=/var/lib/mysql

Enjoy. 🙂

By zam

One thought on “Install/Upgrade to MySQL 5.6 on Ubuntu 12.04 LTS”
  1. Thanks for this nice piece of work.I got a problem to start mysql,I get
    Starting Mysql * Couldn’t find mysql server (/usr/bin/mysqld_safe)

    How can I fix this.Please let me know.

Any Comments?

This site uses Akismet to reduce spam. Learn how your comment data is processed.