Install MySQL 8.0
Step 1: Remove existing and Update the Repositories Packages
apt purge mariadb*
apt purge mysql*
apt-get update
cd /usr/src
Below 2 commands, only if required
apt autoremove
apt --fix-broken install
Step 2: Download latest repo
You can download latest MySQL repo from https://dev.mysql.com/downloads/repo/apt/
Copy the download path after clicking on download and to download, just type wget and paste the copied URL
cd /usr/src
wget https://dev.mysql.com/get/mysql-apt-config_0.8.33-1_all.deb
Installing apt-config
dpkg -i /usr/src/mysql-apt-config_0.8.33-1_all.deb
# if need to reconfigure it
dpkg-reconfigure mysql-apt-config
# select the suitable options in the command line
# recommended MySQL 8.0
Step 3: Make Debian to use mysql package manager instead of default package manager to install MySQL-server
Edit nano /etc/apt/preferences.d/stable
This is to tell debian to use default Debian repo to install packages.
Package: *
Pin: release o=Debian
Pin-Priority: 900
Edit nano /etc/apt/preferences.d/mysql
This is to tell debian to use mysql as repo for mysql8
Package: mysql-*
Pin: origin "repo.mysql.com"
Pin-Priority: 900
Updating the repo and install mysql-server
apt update
apt install mysql-server
Starting and Enabling MySQL service
systemctl status mysql
systemctl enable mysql
systemctl start mysql
systemctl status mysql
To login into Mysql Command line
mysql