How to Install MySQL v5.7 using apt-get on Debian 8 Jessie

Updated on October 11, 2017

This tutorial will explain how to install MySQL v5.7 on Debian 8 Jessie server. The default repositories in Debian 8 will install MySQL version up to 5.6, so if you ever want to install 5.7, then you need to setup a repository that has 5.7 RPMs. Alternatively, you can source compile MySQL 5.7, but this tutorial will explain how to setup a repository that has MySQL version 5.7 and install using apt-get (and you know the advantages of using apt-get – it handles all those necessary dependencies).

And, here we go!

 

Installation of MySQL server v5.7 on Debian

How to install MySQL v5.7 using apt-get?

Step 1: As I told earlier, to install the latest version of MySQL server 5.7, you’ll need to add the newer APT package repository from the official website of MySQL.  Go to MySQL APT repository page and click Download at the bottom right corner. Right click on “No thanks, just start my download” and copy the link address

Download the .deb package to your server, as shown in the example below:

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

Step 2: Install the downloaded .deb file using dpkg – Package Manager.

#dpkg -i mysql-apt-config_0.8.3-1_all.deb

You’ll see a prompt that asks you “which MySQL product do you wish to configure?”. The MySQL server option, which is highlighted, would say your current MySQL version, e.g., mysql-5.6 (in my case). Hit ENTER and scroll down to mysql-5.7 using the arrow keys, and hit ENTER again, which comes back to the first prompt. Now scroll down to Ok using the arrow keys and hit ENTER to exit.

Step 3: Update package index on the server – This step is very important.

#apt-get update

Step 4: Finally, install the MySQL server version 5.7 from the repository. If you have already installed MySQL v5.6, then it would upgraded the necessary packages to 5.7.

#apt-get install mysql-server

During the installation, you’ll be prompted to create a root password, which would be needed later to create and manage databases. Remember to choose a secure password.

Step 5: Finally verify

#mysql --version

Sample Output:

mysql  Ver 14.14 Distrib 5.7.17, for Linux (x86_64) using  EditLine wrapper

Step 6: You can start and stop the MySQL service as below:

#service mysql start|stop|restart|status

That’s it! You have now installed MySQL server version 5.7.

Do not forget to secure your MySQL Installation

It’s advised to secure your MySQL database server soon after the installation, especially on a production machine. The obvious reason is, it improves security of the database.

Did you forget the MySQL root password?

While installing, If you didn’t remember the root password what you typed, then here is the step by step guide to reset your MySQL root Password.

 

Was this article helpful?

Related Articles

Comments Leave a Comment

Leave a Comment