How To Install MySQL 5.6 On Ubuntu 12.10 (Including memcached Plugin)

Version 1.0
Author: Falko Timme
Follow me on Twitter

According to What's New in MySQL 5.6, MySQL 5.6 will bring some performance improvements over MySQL 5.5. If you want to test out MySQL 5.6, you have to install one of the development releases from the MySQL downloads page because there is no stable release yet. This tutorial explains how to install the MySQL 5.6.8rc1 (Linux Generic) development release on an Ubuntu 12.10 server.

This document comes without warranty of any kind! I want to say that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!


1 Preliminary Note

In this tutorial I use the hostname with the IP address These settings might differ for you, so you have to replace them where appropriate.

It is important that you haven't installed any other MySQL version on your system before (not even the one from the Ubutu repositories) because if you did, this tutorial will not work anymore!

Because we must run all the steps from this tutorial with root privileges, we can either prepend all commands in this tutorial with the string sudo, or we become root right now by typing

sudo su 


2 Disabling AppArmor

Your manually installed MySQL 5.6.8 might refuse to start if AppArmor is running, therefore we disable AppArmor:

/etc/init.d/apparmor stop
update-rc.d -f apparmor remove
apt-get remove apparmor apparmor-utils


3 Installing MySQL 5.6.8rc1 (Linux Generic)

First we create a user and group called mysql:

groupadd mysql
useradd -r -g mysql mysql

Next install the libaio1 package:

apt-get install libaio1

We will install MySQL in the /usr/local/mysql directory (with /usr/local/mysql/data being the data directory, i.e., the directory which will contain the databases). Therefore we download MySQL to the /usr/local directory now:

cd /usr/local
wget -O mysql-5.6.8-rc-linux2.6-x86_64.tar.gz

Unpack MySQL, rename the directory to mysql, and make it owned by the user and group mysql:

tar xvfz mysql-5.6.8-rc-linux2.6-x86_64.tar.gz
mv mysql-5.6.8-rc-linux2.6-x86_64 mysql
cd mysql
chown -R mysql .
chgrp -R mysql .


scripts/mysql_install_db --user=mysql

to create the necessary databases (like the mysql database):

Change some ownerships:

chown -R root .
chown -R mysql data

MySQL uses the my.cnf file inside /usr/local/mysql, so we don't have to create one on our own. If you want to change MySQL settings, you can do it in that file.

The downloaded MySQL package comes with the init script mysql.server which we copy to /etc/init.d as follows:

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

It is already executable, so we don't have to change permissions.

We can now start MySQL 5.6 as follows:

/etc/init.d/mysql.server start

To make MySQL start automatically at boot time, run the following command:

update-rc.d mysql.server defaults

The MySQL commands (like mysql, mysql_secure_installation, etc.) are located in the /usr/local/mysql/bin directory which is not in the PATH which means we would have to call these commands with the full or relative path which is cumbersome. To avoid this, we create the following symlink so that we can call all MySQL commands without a path:

ln -s /usr/local/mysql/bin/* /usr/local/bin/

Finally, we should set a MySQL root password:


[email protected]:/usr/local/mysql# mysql_secure_installation


In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
 <-- ENTER
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n]
 <-- ENTER
New password: <-- yourrootsqlpassword
Re-enter new password: <-- yourrootsqlpassword
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n]
 <-- ENTER
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]
 <-- ENTER
 ... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n]
 <-- ENTER
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n]
 <-- ENTER
 ... Success!

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

Cleaning up...
[email protected]:/usr/local/mysql#

Share this page:

6 Comment(s)

Add comment

Please register in our forum first to comment.


By: Anonymous

installation instructions to download and install MySQL 5.6 using source code can be found in that link ... i found them simple


By: Charlie Markwick

wget fails. Will work with:-

wget -O mysql-5.6.8-rc-linux2.6-x86_64.tar.gz

By: danilo

Thanx for the link!

Do you know if rc-linux is the only version we can install? I see the versions keep upgrading to .13 till now, but rc-linux not!

By: Anonymous

Thank you for these great instructions of how to install mysql5.6 on a CLEAN system.

All other instructions found on the entire Internet are inadequate because they want you to install 5.5 first and then overlay 5.6, which results in a very messy and potentially buggy and unsecure install.

By: jony

the line "scripts/mysql_install_db --user=mysql" ain't working .

By: Vikrant

Thank you so much.... It's very helpful and runnable command who are interested to install Mysql 5.6