Installing MySQL 8 on Debian 12

sachin
edited November 14 in Linux

Step 1: Remove existing and Update the Repositories Packages

apt purge mariadb*
apt purge mysql*
apt-get update
cd /usr/src

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

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

# to install the apt config file, run
apt install ./mysql-apt-config_0.8.33-1_all.deb

# 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

Install mysql-server

apt update
apt install mysql-server

Start the service

systemctl enable mysql
systemctl start mysql
systemctl status mysql

To login into Mysql Command line

mysql
Tagged:
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!