Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
I followed the other answers here to do a complete purge of MySQL 8.0 and then followed another tutorial to install MySQL 5.7:
$ cd /tmp/
$ wget https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb
$ sudo dpkg -i mysql-apt-config_0.8.13-1_all.deb
(Select Ubuntu Bionic and then change 8.0 to 5.7)
$ sudo apt-get update
$ sudo apt-cache policy mysql-server
$ sudo apt install -f mysql-client=5.7* mysql-community-server=5.7* mysql-server=5.7*
$ sudo mysql_secure_installation
One thing that is missing is that you need to “pin” the Ubuntu package manager to MySQL 5.7 otherwise it will try re-install MySQL 8.0 every time you run sudo apt-get dist-upgrade !
sudo vi /etc/apt/preferences.d/mysql
Package: mysql-server
Pin: version 5.7*
Pin-Priority: 1001
Package: mysql-client
Pin: version 5.7*
Pin-Priority: 1001
Package: mysql-community-server
Pin: version 5.7*
Pin-Priority: 1001
Package: mysql-community-client
Pin: version 5.7*
Pin-Priority: 1001
Package: libmysqlclient-dev
Pin: version 5.7*
Pin-Priority: 1001
See: https://askubuntu.com/questions/1313532/ubuntu-server-20-04-2-how-to-hold-mysql-to-5-7
Hi @foxywd,
Before you begin, I urge you to do a snapshot of your droplet just in ace.
First, you need to uninstall anything that is related to MySQL:
sudo apt-get purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
Then the important bit, this error could be caused because your distribution is not upgraded recently, or at least conflicts are not resolved properly. So next thing is to upgrade it like this:
sudo apt-get dist-upgrade
Now after this is done, you can try to install mysql as normal again.
Another solution would be to see if any leftovers are there
sudo rm -rf /etc/mysql
sudo rm -rf /var/lib/mysql*
Once you remove them you should be able to install MySQL. Please note that removing these folders will mean losing your old configuration files.
Regards, KFSys
For anyone who now attempts to use this article (for Ubuntu 20.04) you need to change the version from 5.7.32 to instead be 5.7.33
sudo apt install -f mysql-client=5.7.33-1ubuntu18.04 mysql-community-server=5.7.33-1ubuntu18.04 mysql-server=5.7.33-1ubuntu18.04