How to install MySQL community server on Debian 9

How to install MySQL community server on Debian 9

In this tutorial I will shoe you, how to install MySQL community server on Debian 9 server.

Obtain Repository Config

Most likely the easiest way to install MySQL community server on Debian 9 Stretch is via pre-reconfigured official MySQL repositories. This can be achieved by downloading and installing a mysql-apt-config_*_all.deb package.

Head over to and download the latest MySQL APT Repository package. Example:

$ wget
$ ls

Install Repository Config

Now that you have MySQL APT Repository package available, use gdebi command to install it. In case the gdebi command is not available on your system you can install it by # apt install gdebi-core:

# gdebi mysql-apt-config_0.8.6-1_all.deb 
Reading package lists... Done
Building dependency tree        
Reading state information... Done
Reading state information... Done

Auto configuration for MySQL APT Repo.
 MySQL is a fast, stable and true multi-user, multi-threaded SQL database
 server. SQL (Structured Query Language) is the most popular database query
 language in the world. The main goals of MySQL are speed, robustness and
 ease of use.
Do you want to install the software package? [y/N]:y

Follow the installation wizard by selecting an appropriate MySQL server version and repositories. Default should work in most cases. You can always review your selection manual by editing /etc/apt/sources.list.d/mysql.list sources list directly.

Install MySQL Server

At this stage make sure to run:

# apt update

command to update system’s package repositories. After that, all what has left is to install MySQL packages using apt command.

# apt install mysql-server

The above command will also fetch and install MySQL client. Once installed, confirm the installation by accessing MySQL console:

# mysql -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.18 MySQL Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

Enjoyed this video?
How to install MySQL community server on Debian 9
"No Thanks. Please Close This Box!"