How to Install the Latest MySQL 8 on Debian 10 Buster

29/12/2020
This tutorial explains how to install Mysql 8 on Debian 10 Buster but it is also useful for previous Debian versions, while writing it, I found some errors related to an old Mysql installation and the troubleshooting process was included below the installation process instructions.

Installing Mysql 8 on Debian 10 Buster

Before installing Mysql there is need to setup the repository you can get by running the following wget command:

$ wget http://repo.mysql.com/mysql-apt-config_0.8.14-1_all.deb

Install the apt repository by running:

$ dpkg -i mysql-apt-config_0.8.14-1_all.deb

Note: for a tutorial on the dpkg command you can access  All about the debian package managers: dpkg, apt and aptitude explained tutorial.

Press ENTER on OK to continue.

Select the OK option and browse using the TAB key to press OK and continue.

The installation will end showing a similar output than the image below:

Now to install Mysql 8 run:

$ apt update && apt install mysql-server -y

The following warning screen should not prompt to users who had not Mysql installed previously, if you had a working mysql installation you can backup all files before continuing, otherwise you can ignore it and press OK to continue. If you need to backup files then do it on an alternative terminal and then press OK.

The next screen will request a password.

Then you’ll need to confirm the password:

Depending on your needs Mysql 8 will offer you to increase security by replacing the authentication method, don’t use this option if you have older Mysql clients who need to connect to your server, otherwise accept and go ahead by using the strong password encryption, press TAB and OK to continue.

The installation will start:

Once finished you can check your Mysql server by executing:

$ service mysql status

Note: you can access the Stop, start and restart services on Debian tutorial to learn managing services.

Mysql installation troubleshooting

In my particular case the installation didn’t go successful at the first attempt due to problems with an old installation I didn’t remove prior to Mysql 8 installation.

Additionally to screenshots I paste the errors content to make it easy for users sharing the same problem to find my solution.

When installing Mysql 8 on Debian 10 Buster I met the following error:

dpkg: dependency problems prevent configuration of mysqlserver:
mysqlserver depends on mysqlcommunityserver (= 8.0.181debian10); however:
Package mysqlcommunityserver is not configured yet.
dpkg: error processing package mysqlserver (configure):
dependency problems leaving unconfigured

Running the following command didn’t solve the problem:

$ apt install -f
Failed to preset unit: File mysql.service: Link has been severed
/usr/bin/debsystemdhelper: error: systemctl preset failed on mysql.service:
 No such file or directory
Failed to get unit file state for mysql.service: Link has been severed
mysql.service is a disabled or a static unit, not starting it.
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
invokerc.d: initscript mysql, action "start" failed.
mysql.service MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; bad; vendor preset: enabled)
Active: failed (Result: exitcode) since Wed 20191218 20:54:55 03; 18ms ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/usingsystemd.html
Process: 27022 ExecStartPre=/usr/share/mysql8.0/mysqlsystemdstart pre
(code=exited, status=0/SUCCESS)
Process: 27057 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Main PID: 27057 (code=exited, status=1/FAILURE)
Status: "Data Dictionary upgrade from MySQL 5.7 in progress"
Dec 18 20:54:54 linuxhint systemd[1]: Starting MySQL Community Server…
Dec 18 20:54:55 linuxhint systemd[1]: mysql.service: Main process exited,
 code=exited, status=1/FAILURE
Dec 18 20:54:55 linuxhint systemd[1]: mysql.service: Failed with result ‘exit-code’.

The first step to solve this issue is to purge all previous Mysql related files:

$ apt purge mysqlclient5.7 mysqlclientcore5.7 mysqlcommon
mysqlserver5.7 mysqlservercore5.7 mysqlserver

When asked confirmation use the TAB key to move to YES and press ENTER.

Then update, remove unnecessary left packages and resolve dependencies if needed by running:

$ apt update &&  apt autoremove && sudo apt -f install

When asked type Y and press ENTER to continue.

Once finished you can proceed with the Mysql installation again by running:

$ apt install mysql-server

Press Y and ENTER when asked to confirm the installation.

The installation will offer you to set a password again:

If you use a password confirm it again:

Decide if you want to increase Mysql encryption to leave it compatible with old Mysql client versions and proceed, if you don’t need compatibility with old Mysql versions leave the default option and select OK to continue.

The installation should take place successfully:

Related articles

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Connecting to MariaDB with PyMySQL

PyMySQL is a free and open source project released under the MIT License. PyMySQL is a MySQL library that can be used to...
29/12/2020

Expose MySQL and MariaDB Database Server to the Internet

MariaDB/MySQL database server only runs on the IP 127.0.0.1 or the hostname localhost by default. So, it is not accessible...
29/12/2020

Installing phpMyAdmin on Debian 10

phpMyAdmin is a web based tool for managing MySQL/MariaDB databases. In this article, I am going to show you how to install...
29/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

SỰ KHÁC BIỆT GIỮA RESIDENTIAL PROXY VÀ PROXY DATACENTER
17/02/2024

Mua Proxy v6 US Private chạy PRE, Face, Insta, Gmail
07/01/2024

Mua shadowsocks và hướng dẫn sữ dụng trên window
05/01/2024

Tại sao Proxy Socks lại được ưa chuộng hơn Proxy HTTP?
04/01/2024

Mua thuê proxy v4 nuôi zalo chất lượng cao, kinh nghiệm tránh quét tài khoản zalo
02/01/2024