1

I have MySQL installed on my test server (Debian 10). I recently updated it to the newest version (8.0.29), but there are some issues with it so I want to go back to an older version (8.0.28). But I can't for the life of me figure out how to do so.

I have removed the existing database, and tried to re-install it using:

apt-get install mysql-server=8.0.28-1debian10

but that didn't work, and suggested I run:

apt --fix-broken install

which of course upgraded it to the latest version again.

I have tried numerous variations of this,but all result in mysql-server can't be found or similar errors.

I have been scouring the internet, and there seems to be lots of people asking similar questions, but no real solutions. Even the official MySQL documentation glosses over this bit.

Can it be done? And if so, how? It's only a test database so I have no issues with scrapping it and starting again.

IGGt
  • 2,266
  • 6
  • 35
  • 49

2 Answers2

1

If you have data first make a backup.

To completely uninstall MySQL follow below steps:

sudo apt-get purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get dist-upgrade
sudo rm -rf /etc/mysql
sudo rm -rf /var/lib/mysql*

To install MySQL 8.0.22 add the MySQL Software Repository

sudo apt update
sudo apt install gnupg

Download mysql-server_8.0.22-1debian10_amd64.deb-bundle.tar from MySQL archive or using wget :

wget https://downloads.mysql.com/archives/get/p/23/file/mysql-server_8.0.22-1debian10_amd64.deb-bundle.tar

Once the download is completed install the package :

sudo dpkg -i mysql-apt-config*

During the installation, you’ll be presented with a configuration screen where you can specify which version of MySQL you’d prefer, along with an option to install repositories for other MySQL-related tools. Choose the one you need.

Refresh your apt package cache to make the new software packages available:

sudo apt update

Having added the repository and with your package cache freshly updated, now you can use apt to install the latest MySQL server package:

sudo apt install mysql-server

MySQL should be installed and running now. Check by using systemctl:

sudo systemctl status mysql

Do not forget to secure MySQL using

mysql_secure_installation

Refrences

https://www.digitalocean.com/community/questions/how-can-i-properly-downgrade-from-mysql-8-to-5-7-on-ubuntu-20-04

https://www.digitalocean.com/community/tutorials/how-to-install-the-latest-mysql-on-debian-10

Ergest Basha
  • 5,369
  • 3
  • 7
  • 22
1

So I got there in the end. This may not all be strictly correct, and there may be better ways to do this, however it works for me:

  1. Take a MySQLDump backup first if required.

  2. Remove the Old MySQL Version

systemctl stop mysql

apt-get remove --purge 'mysql-.*'

apt-get autoremove

apt-get autoclean

apt-get dist-upgrade

rm -rf /etc/mysql

rm -rf /var/lib/mysql*

  1. Download the new version bundle

cd /root

wget https://downloads.mysql.com/archives/get/p/23/file/mysql-server_8.0.28-1debian10_amd64.deb-bundle.tar

  1. extract the files and install in this order

mkdir 828

tar -xvf mysql-server_8.0.28-1debian10_amd64.deb-bundle.tar -C /root/828 cd /root/828 dpkg -i libmysqlclient21_8.0.28-1debian10_amd64.deb

dpkg -i mysql-common_8.0.28-1debian10_amd64.deb

dpkg -i mysql-community-client-plugins_8.0.28-1debian10_amd64.deb

dpkg -i mysql-community-client-core_8.0.28-1debian10_amd64.deb

dpkg -i mysql-community-client_8.0.28-1debian10_amd64.deb

dpkg -i mysql-client_8.0.28-1debian10_amd64.deb

dpkg -i mysql-community-server-core_8.0.28-1debian10_amd64.deb

apt --fix-broken install

dpkg -i mysql-community-server-core_8.0.28-1debian10_amd64.deb

dpkg -i mysql-community-server_8.0.28-1debian10_amd64.deb

dpkg -i mysql-server_8.0.28-1debian10_amd64.deb

It should now be working with the correct version:

systemctl status mysql

mysqld- V /usr/sbin/mysqld Ver 8.0.28 for Linux on x86_64 (MySQL Community Server - GPL)

Finally, secure the database mysql_secure_installation

IGGt
  • 2,266
  • 6
  • 35
  • 49