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.

1
  • 1
    What sort of issues should people watch out for in this upgrade that affected you?
    – danblack
    Commented May 6, 2022 at 2:16

2 Answers 2

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

4
  • The only suggestion is that backup should be logical by mysqldump, not physical by xtrabackup, Physical backups can be not backward compatible with earlier versions of mysql.
    – Kondybas
    Commented May 6, 2022 at 2:52
  • Sadly, I followed these instructions, and they removed mysql ok (apart from the first line which it seems needed to be apt-get remove --purge 'mysql-.*', but then it re-installed the latest version again instead of the older version that I was after.
    – IGGt
    Commented May 6, 2022 at 11:04
  • I got there cheers. The first half is as you suggested, the second half is slightly different,
    – IGGt
    Commented May 6, 2022 at 14:57
  • I'll take a closer look, but whenever I have run it the only options are for MySQL 8.0 (latest version) or MySQL 5.7 (latest version) as well as a few other options such as with or without Cluster.
    – IGGt
    Commented May 9, 2022 at 7:14
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.