How to install MySQL 5.6 on Ubuntu 14.04


Ubuntu 14.04 comes preloaded with MySQL 5.5 and MySQL 5.6 but by default uses MySQL 5.5. However, you can upgrade to MySQL 5.6 by following the same step i used for my server , hosted at digital ocean.

So far i have not encountered any problem, i also converted my database engine from Myisam to InnoDB without any errors. so lets begin.

Step 1 – Backup, Backup!

Before we begin, lets take backup of our existing databases in case of “Had i known”. Create a folder anywhere you want then login to terminal or putty and issue this command.

mysqldump -u root -p databasename > /path/to/folder/databasename.sql

Step 2 – Remove old MySQL

I recommend using ‘apt-get purge’ rather than using ‘apt-get remove’ to uninstall the old MySQL server. Don’t worry, this doesn’t mean all your data in /var/lib/mysql will be deleted.

The purge command will remove all the configuration files in /etc/mysql/ . we are doing this because some old MySQL configurations are not supported in MySQL 5.6.

Now run…….

apt-get purge mysql-server-5.5 mysql-client-5.5

and then……..

apt-get autoremove

Step 3 – Install MySQL 5.6

Now its time to install MySQL5.6, by running the following command in terminal or putty, remember to add sudo at the beginning if you are using another user instead of root user

apt-get install mysql-server-5.6 mysql-client-5.6

Please note during the installation process you will be asked to set up a new password for the root user. if everything goes well you have successfully upgraded your MySQL server from 5.5 to 5.6.

to check your MySQL installed version on your Ubuntu 14.04 run the following:

mysql –version


To restart the mysql service

service mysql restart

To start mysql Service

service mysql start

To stop mysql service

service mysql stop

To get status of mysql service

service mysql status