How to install MySql 5.6 or Mysql 6.7

Posted by on March 9, 2019

New versions of ubuntu and debian come with mariadDB as predefined mysql server. But if we need to run a version of MySQL we can do it with the following steps.

Remove any existing mysql server from the machine

sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean

Download latest repository from https://dev.mysql.com/downloads/repo/apt/

wget https://dev.mysql.com/get/mysql-apt-config_0.8.12-1_all.deb

Install the repository tool

sudo dpkg -i mysql-apt-config_0.8.12-1_all.deb

In this step you can selet the version you want to use.

Finaly, install the server

apt-get update
apt-get install mysql-community-server

If you are on Debian 9 you may get the message:

The following packages have unmet dependencies:
 mysql-community-server : Depends: libmecab2 but it is not installable

The install the package and reinstall the mysql-community-server

wget http://ftp.br.debian.org/debian/pool/main/m/mecab/libmecab2_0.996-3.1_amd64.deb
sudo dpkg -i libmecab2_0.996-3.1_amd64.deb
sudo apt-get update
sudo apt-get install libmecab2
sudo apt-get -y install mysql-community-server