Objective
MySQL is no longer a default SQL database on Debian Linux starting with Debian 9 Stretch. The objective is to install MySQL community server using official MySQL repositories.
Operating System and Software Versions
- Operating System: – Debian 9 Stretch
- Software: – MySQL Community Server 5.7.18
Requirements
Privileged access to to your Debian server will be required.
Difficulty
EASY
Conventions
- # – requires given linux commands to be executed with root privileges either directly as a root user or by use of
sudo
command - $ – requires given linux commands to be executed as a regular non-privileged user
Instructions
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 https://dev.mysql.com/downloads/repo/apt/
and download the latest MySQL APT Repository package. Example:
$ wget https://dev.mysql.com/get/mysql-apt-config_0.8.6-1_all.deb $ ls mysql-apt-config_0.8.6-1_all.deb
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 owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>