Quick guide to Upgrade MySQL 5.5 to MySQL 5.6

Upgrade MySQL 5.5 to MySQL 5.6
Upgrade MySQL 5.5 to MySQL 5.6

In this article, we are going to upgrade the MySQL version with 5 easy steps.

Before upgrading, let’s see some important benefits of Mysql Version 5.6,

MySQL 5.6 has provides a lot of enhancements, specifically with regards to replication:

  • Global transaction identifiers offer an efficient way to deal with the hassles of maintaining a replication topology when a master crashes.
  • Multi-threaded replication is an excellent solution to overcome the performance limitations of normal single-threaded replication.
  • Crash-safe replication provides a new configuration to make replication more resilient in case of a crash.
  • Binlog checksums aim at avoiding data corruption.

Steps to Upgrade MySql Version 5.5 TO 5.6

Step 1: Check Current Version & Dependency Package

Before start with the upgrade, first, check which MySQL version and it’s related packages currently installed on the server.

To check run below commands,

$ mysql -V
MySQL Ver 14.14 Distrib 5.5.46, for debian-linux-gnu (x86_64) using readline 6.3
$ dpkg -l | grep mysql

ii libdbd-mysql-perl 4.028-2+b1 amd64 Perl5 database interface to the MySQL database

ii libmysqlclient18:amd64 5.5.46-0+deb8u1 amd64 MySQL database client library

ii mysql-client 5.5.46-0+deb8u1 all MySQL database client (metapackage depending on the latest version)

ii mysql-client-5.5 5.5.46-0+deb8u1 amd64 MySQL database client binaries

ii mysql-common 5.5.46-0+deb8u1 all MySQL database common files, e.g. /etc/mysql/my.cnf

ii mysql-server 5.5.46-0+deb8u1 all MySQL database server (metapackage depending on the latest version)

ii mysql-server-5.5 5.5.46-0+deb8u1 amd64 MySQL database server binaries and system database setup

ii mysql-server-core-5.5 5.5.46-0+deb8u1 amd64 MySQL database server binaries

ii php5-mysql 5.6.29+dfsg-0+deb8u1 amd64 MySQL module for php5

ii php7.0-mysql 7.0.14-1~dotdeb+8.1 amd64 MySQL module for PHP

Step 2: Backup Database

Once you get the current MySQL version and dependency, packages information. We will start the steps to upgrade Mysql-server.

Upgrading MySQL version is an easy task.

But before doing this, we will take the backup of current databases.

This upgradations steps will not affect your current database or its settings.

Just for the safer side, we will make one backup copy of the available databases.

The below command is used to dump a single database in .gz format.

It will save your storage on the system.

$ mysqldump -u root -p dbname | gzip -9 dbname.sql.gz

You can also take a dump of all database in a single file using below command,

$ mysqldump -u root -p --all-databases | gzip -9 > alldatabases.sql.gz

Step 3: Add Repository for Mysql 5.6

Now we are going to add the repository for the latest MySQL version.

Run below command in the terminal which helps you to download the repository file on the system.

$ wget -O mysql-apt-config.deb https://dev.mysql.com/get/mysql-apt-config_0.3.7-1debian8_all.deb

After downloading the file, use the below “dpkg” command to install .deb file.

$ dpkg -i mysql-apt-config.deb

When you run the above command, it will prompt you to choose MySQL version from 5.6 and 5.7. Choose any one as per your requirement.

Refer below screens, so you will get the idea to choose the MySQL version.

mysql version upgrade
Mysql version 5.6
Mysql install

Step 4: Upgrade Mysql Version

Now run below commands which helps you to upgrade the MySQL version.

$ apt-get update

When you run below the install command, it will remove the older MySQL version and installed the latest MySQL version on the system.

$ apt-get install mysql-server

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
Use 'apt-get autoremove' to remove it.
The following extra packages will be installed:
libnuma1 mysql-client mysql-common mysql-community-client mysql-community-server
The following packages will be REMOVED:
mysql-client-5.5 mysql-server-5.5 mysql-server-core-5.5
The following NEW packages will be installed:
libnuma1 mysql-community-client mysql-community-server
The following packages will be upgraded:
mysql-client mysql-common mysql-server
3 upgraded, 3 newly installed, 3 to remove and 193 not upgraded.
Need to get 23.2 MB of archives.
After this operation, 75.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y

Step 5: Restart Mysql Service

After completion of the upgrade command. Restart the MySQL service and check the MySQL version using the below commands.

$ /etc/init.d/mysql restart

$ mysql -V

That’s it. Mysql Version upgrade is completed. Now restore the backup database and check the functionality of your application.

I hope you like the article if you find any difficulties then please do comment queries or problem via the comment section, till then stay tuned to Linuxgrow.com for more such valuable articles.


Welcome to Linuxgrow. I'm Prashant, a tech-blogger from Mumbai, India. I started Linuxgrow as a passion and to share my knowledge about technologies. Here at Linuxgrow, I write about Linux technologies, Aws Cloud, Wordpress blogging and scripting knowledge. You can read more about me at About us page. Thank You :)

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *