First of all, create a backup of your server or VM in case that anything will go wrong during the update process or any applications will not work anymore after updating your MySQL Server.
After that create a copy of your existing MySQL config as a backup:
Now browse to http://dev.mysql.com/downloads/repo/apt/ and check which is the latest available MySQL version package. In our case mysql-apt-config_0.7.3-1_all.deb. Now log in to your server via SSH with root access. Download and install the tool:
dpkg -i mysql-apt-config_0.7.3-1_all.deb
During the installation you will be asked which version you want to install so you can decide to update to MySQL 5.6 or 5.7.
After the installation wizard is finished, perform the following commands
apt-get install mysql-server
If you are being asked to update your my.cnf, select yes. That’s it.